Permalink
Browse files

More progress

  • Loading branch information...
delano committed Jul 18, 2010
1 parent 4175934 commit 9b5c296fcac90e434841351f2610cbca08530fd2
Showing with 71 additions and 84 deletions.
  1. +71 −84 try/51_hash_history_try.rb
View
@@ -1,91 +1,78 @@
+require 'gibbler'
+require 'gibbler/history'
+# "Setup Hash class", Hash do
+class ::Hash
+ include Gibbler::History
+end
+end
+
+# "doesn't reveal self.__gibbler_history instance variable", false do
+a = {}
+a.gibbler # We need to gibbler first so it sets a value to the instance var
+val = Tryouts.sysinfo.ruby[1] == 9 ? :'self.__gibbler_history' : 'self.__gibbler_history'
+a.instance_variables.member? val
+end
+
+# "can take a Hash snapshot", 'd7049916ddb25e6cc438b1028fb957e5139f9910' do
+a = { :magic => :original }
+a.gibbler_commit
+end
+
+#=> :class, Array
+#=> :size, 2
+#=> ['d7049916ddb25e6cc438b1028fb957e5139f9910', 'b668098e16d08898532bf3aa33ce2253a3a4150e']
+# "return a Hash history" do
+a = { :magic => :original }
+a.gibbler_commit
+a[:magic] = :updated
+a.gibbler_commit
+a.gibbler_history
+end
-library :gibbler, File.dirname(__FILE__), '..', 'lib'
-library 'gibbler/history', File.dirname(__FILE__), '..', 'lib'
+# "can revert Hash" do
+a = { :magic => :original }
+a.gibbler_commit
+a[:magic] = :updated
+a.gibbler_revert!
+#=> 'd7049916ddb25e6cc438b1028fb957e5139f9910'
-group "History"
+# "knows a valid gibble", true do
+a = { :magic => :original }
+a.gibbler_commit
+a.gibbler_valid? 'd7049916ddb25e6cc438b1028fb957e5139f9910'
+#=> true
-Gibbler.enable_debug if Tryouts.verbose > 3
+# "knows an invalid gibble", false do
+a = { :magic => :original }
+a.gibbler_commit
+a.gibbler_valid? '2222222222222222222222222222222222222222'
+#=> false
+# "can revert to any valid gibble" do
+a = { :magic => :original }
+a.gibbler_commit
+a[:magic] = :updated
+a.gibbler_commit
+a[:magic] = :changed
+a.gibbler_commit
+a.gibbler_revert! 'd7049916ddb25e6cc438b1028fb957e5139f9910'
+a
+#=> Hash[:magic => :original]
-tryouts "Hash History" do
-
- drill "Setup Hash class", Hash do
- class ::Hash
- include Gibbler::History
- end
- end
-
- drill "doesn't reveal self.__gibbler_history instance variable", false do
- a = {}
- a.gibbler # We need to gibbler first so it sets a value to the instance var
- val = Tryouts.sysinfo.ruby[1] == 9 ? :'self.__gibbler_history' : 'self.__gibbler_history'
- a.instance_variables.member? val
- end
-
- drill "can take a Hash snapshot", 'd7049916ddb25e6cc438b1028fb957e5139f9910' do
- a = { :magic => :original }
- a.gibbler_commit
- end
-
- dream :class, Array
- dream :size, 2
- dream ['d7049916ddb25e6cc438b1028fb957e5139f9910', 'b668098e16d08898532bf3aa33ce2253a3a4150e']
- drill "return a Hash history" do
- a = { :magic => :original }
- a.gibbler_commit
- a[:magic] = :updated
- a.gibbler_commit
- a.gibbler_history
- end
-
- dream 'd7049916ddb25e6cc438b1028fb957e5139f9910'
- drill "can revert Hash" do
- a = { :magic => :original }
- a.gibbler_commit
- a[:magic] = :updated
- a.gibbler_revert!
- end
-
- drill "knows a valid gibble", true do
- a = { :magic => :original }
- a.gibbler_commit
- a.gibbler_valid? 'd7049916ddb25e6cc438b1028fb957e5139f9910'
- end
-
- drill "knows an invalid gibble", false do
- a = { :magic => :original }
- a.gibbler_commit
- a.gibbler_valid? '2222222222222222222222222222222222222222'
- end
-
- dream Hash[:magic => :original]
- drill "can revert to any valid gibble" do
- a = { :magic => :original }
- a.gibbler_commit
- a[:magic] = :updated
- a.gibbler_commit
- a[:magic] = :changed
- a.gibbler_commit
- a.gibbler_revert! 'd7049916ddb25e6cc438b1028fb957e5139f9910'
- a
- end
-
- dream Hash[:magic => :original]
- dream :gibbler, 'd7049916ddb25e6cc438b1028fb957e5139f9910'
- drill "revert does nothing if digest is the same as current one" do
- a = { :magic => :original }
- a.gibbler_commit
- a.gibbler_revert!
- a
- end
-
- dream 'd7049916ddb25e6cc438b1028fb957e5139f9910'
- drill "can revert using short gibble" do
- a = { :magic => :original }
- a.gibbler_commit
- a[:magic] = :updated
- a.gibbler_revert! 'd7049916'
- end
-
+#=> Hash[:magic => :original]
+#=> :gibbler, 'd7049916ddb25e6cc438b1028fb957e5139f9910'
+# "revert does nothing if digest is the same as current one" do
+a = { :magic => :original }
+a.gibbler_commit
+a.gibbler_revert!
+a
end
+
+# "can revert using short gibble
+a = { :magic => :original }
+a.gibbler_commit
+a[:magic] = :updated
+a.gibbler_revert! 'd7049916'
+#=> 'd7049916ddb25e6cc438b1028fb957e5139f9910'
+

0 comments on commit 9b5c296

Please sign in to comment.