Permalink
Browse files

Finished Tryout 2 conversion

  • Loading branch information...
1 parent ac795f9 commit 1a3f6ee15e69cf4d53f3a6b1468d1e14fd09895a @delano committed Jul 18, 2010
@@ -1,44 +1,36 @@
+require 'gibbler'
+require 'gibbler/history'
+
+class Array
+ include Gibbler::History
+end
-library :gibbler, File.dirname(__FILE__), '..', 'lib'
-library 'gibbler/history', File.dirname(__FILE__), '..', 'lib'
-group "History"
+# "can take a Array snapshot"
+a = [:jesse]
+a.gibbler_commit
+#=> 'd95fcabb498ae282f356eba63da541e4f72c6efa'
-Gibbler.enable_debug if Tryouts.verbose > 3
+# "return an Array history" do
+a = [:jesse]
+a.gibbler_commit
+a << :joey
+a.gibbler_commit
+a.gibbler_history
+#=> ['d95fcabb498ae282f356eba63da541e4f72c6efa', 'eebcb2e84e828b1a7207af4d588cf41fd4c6393a']
+# "can revert Array" do
+a = [:jesse]
+a.gibbler_commit
+a << :joey
+a.gibbler_revert!
+#=> 'd95fcabb498ae282f356eba63da541e4f72c6efa'
-tryouts "Array History" do
-
- drill "Setup Array class", Array do
- class ::Array
- include Gibbler::History
- end
- end
-
- drill "can take a Array snapshot", 'd95fcabb498ae282f356eba63da541e4f72c6efa' do
- a = [:jesse]
- a.gibbler_commit
- end
-
- dream :class, Array
- dream :size, 2
- dream ['d95fcabb498ae282f356eba63da541e4f72c6efa', 'eebcb2e84e828b1a7207af4d588cf41fd4c6393a']
- drill "return an Array history" do
- a = [:jesse]
- a.gibbler_commit
- a << :joey
- a.gibbler_commit
- a.gibbler_history
- end
-
- dream 'd95fcabb498ae282f356eba63da541e4f72c6efa'
- drill "can revert Array" do
- a = [:jesse]
- stash :original, a.gibbler_commit
- a << :joey
- stash :updated, a.gibbler
- a.gibbler_revert!
- end
-
-
+# Raises exception when no history
+begin
+a = [:jesse]
+a.gibbler_revert!
+rescue Gibbler::NoHistory
+ :success
end
+#=> :success
@@ -1,43 +1,29 @@
-library :gibbler, File.dirname(__FILE__), '..', 'lib'
-library 'gibbler/history', File.dirname(__FILE__), '..', 'lib'
+require 'gibbler'
+require 'gibbler/history'
-group "History"
+class String
+ include Gibbler::History
+end
-Gibbler.enable_debug if Tryouts.verbose > 3
+# "can take a String snapshot" do
+a = "kimmy"
+a.gibbler_commit
+#=> 'c8027100ecc54945ab15ddac529230e38b1ba6a1'
+# "return a String history" do
+a = "kimmy"
+a.gibbler_commit
+a << " gibbler"
+a.gibbler_commit
+a.gibbler_history
+#=> ['c8027100ecc54945ab15ddac529230e38b1ba6a1', '692c05d3186baf2da36e87b7bc5fe53ef13b902e']
+
+# "can revert String" do
+a = "kimmy"
+a.gibbler_commit
+a << " gibbler"
+a.gibbler
+a.gibbler_revert!
+#=> 'c8027100ecc54945ab15ddac529230e38b1ba6a1'
-tryouts "String History" do
-
- drill "Setup String class", String do
- class ::String
- include Gibbler::History
- end
- end
-
- drill "can take a String snapshot", 'c8027100ecc54945ab15ddac529230e38b1ba6a1' do
- a = "kimmy"
- a.gibbler_commit
- end
-
- dream :class, Array
- dream :size, 2
- dream ['c8027100ecc54945ab15ddac529230e38b1ba6a1', '692c05d3186baf2da36e87b7bc5fe53ef13b902e']
- drill "return a String history" do
- a = "kimmy"
- a.gibbler_commit
- a << " gibbler"
- a.gibbler_commit
- a.gibbler_history
- end
-
- dream 'c8027100ecc54945ab15ddac529230e38b1ba6a1'
- drill "can revert String" do
- a = "kimmy"
- stash :original, a.gibbler_commit
- a << " gibbler"
- stash :updated, a.gibbler
- a.gibbler_revert!
- end
-
-end
@@ -1,45 +1,31 @@
-library :gibbler, File.dirname(__FILE__), '..', 'lib'
-library 'gibbler/history', File.dirname(__FILE__), '..', 'lib'
+require 'gibbler'
+require 'gibbler/history'
-group "History"
+class ::FullHouse
+ include Gibbler::Complex
+ include Gibbler::History
+ attr_accessor :roles
+end
-Gibbler.enable_debug if Tryouts.verbose > 3
+# "can take a FullHouse snapshot"
+ a = FullHouse.new
+ a.gibbler_commit
+#=> '4192d4cb59975813f117a51dcd4454ac16df6703'
+# "return a FullHouse history" do
+ a = FullHouse.new
+ a.gibbler_commit
+ a.roles = [:jesse]
+ a.gibbler_commit
+ a.gibbler_history
+#=> ['4192d4cb59975813f117a51dcd4454ac16df6703', '05219bdee8ec6300b579f2ba8ce55d851d10928b']
+# "can revert FullHouse" do
+ a = FullHouse.new
+ a.gibbler_commit
+ a.roles = [:jesse]
+ a.gibbler
+ a.gibbler_revert!
+#=> '4192d4cb59975813f117a51dcd4454ac16df6703'
-tryouts "Arbitrary Object History" do
-
- drill "Setup String class", 'FullHouse' do
- class ::FullHouse
- include Gibbler::Complex
- include Gibbler::History
- attr_accessor :roles
- end
- FullHouse.to_s
- end
-
- drill "can take a FullHouse snapshot", '4192d4cb59975813f117a51dcd4454ac16df6703' do
- a = FullHouse.new
- a.gibbler_commit
- end
-
- dream ['4192d4cb59975813f117a51dcd4454ac16df6703', '05219bdee8ec6300b579f2ba8ce55d851d10928b']
- drill "return a FullHouse history" do
- a = FullHouse.new
- a.gibbler_commit
- a.roles = [:jesse]
- a.gibbler_commit
- a.gibbler_history
- end
-
- dream '4192d4cb59975813f117a51dcd4454ac16df6703'
- drill "can revert FullHouse" do
- a = FullHouse.new
- stash :original, a.gibbler_commit
- a.roles = [:jesse]
- stash :updated, a.gibbler
- a.gibbler_revert!
- end
-
-end
@@ -1,30 +1,31 @@
+require 'gibbler'
+require 'gibbler/history'
-library :gibbler, File.dirname(__FILE__), '..', 'lib'
-library 'gibbler/history', File.dirname(__FILE__), '..', 'lib'
-group "History"
+# "raises exception when reverting to unknown gibble" do
+begin
+ a = {}
+ a.gibbler_commit
+ a.gibbler_revert! '2222222222222222222222222222222222222222'
+rescue Gibbler::BadDigest
+ :success
+end
+#=> :success
-Gibbler.enable_debug if Tryouts.verbose > 3
+# "raises exception when reverting and there's no history" do
+begin
+ a = []
+ a.gibbler_revert!
+rescue Gibbler::NoHistory
+ :success
+end
+#=> :success
+# "raises exception when reverting an unsupported object" do
+begin
+ :kimmy.gibbler_revert!
+rescue NoMethodError
+ :success
+end
+#=> :success
-tryouts "Exceptions" do
-
- dream :exception, Gibbler::BadDigest
- drill "raises exception when reverting to unknown gibble" do
- a = {}
- a.gibbler_commit
- a.gibbler_revert! '2222222222222222222222222222222222222222'
- end
-
- dream :exception, Gibbler::NoHistory
- drill "raises exception when reverting and there's no history" do
- a = []
- a.gibbler_revert!
- end
-
- dream :exception, NoMethodError
- drill "raises exception when reverting an unsupported object" do
- :kimmy.gibbler_revert!
- end
-
-end
Oops, something went wrong.

0 comments on commit 1a3f6ee

Please sign in to comment.