README.rdoc in object-history-0.0.1 vs README.rdoc in object-history-0.0.2

- old
+ new

@@ -1,8 +1,9 @@ = object-history Test your objects with history path. + http://travis-ci.org/LTe/object-history.png == Instalation Add to your Gemfile gem 'object-history' @@ -17,11 +18,12 @@ class TrackedObject include ObjectHistory track_history_of :your_method end -== Example +== Examples +=== Track object class TrackedObject attr_accessor :number def initialize(child = nil) @number = 0 @@ -46,9 +48,72 @@ it "should every execute add one to :number" do 3.times {@track_object.add_one} @track_object.should have_track(:number, [0,1,2,3]) end end + +=== Post example + class Post + attr_accessor :status + + def initialize + @status = :new + end + + def accept + @status = :accepted + end + + def send_post + @status = :sent + end + + def load + @status = :loaded + end + + include ObjectHistory + track_history_of :accept, :send_post, :load + end + +And *Rspec* + before(:each) do + @post = Post.new + end + + it "should have [:new, :loaded, :accepted, :sent] path" do + @post.load + @post.accept + @post.send_post + + @post.should have_track(:status, [:new, :loaded, :accepted, :sent]) + end + +=== Accessors + class Accessor + attr_accessor :version + + def initialize + @version = 0 + end + + include ObjectHistory + track_history_of :version= + end + +*Rspec* + before(:each) do + @accessor = Accessor.new + end + + it "should track accessor" do + @accessor.version = 5 + @accessor.version = 10 + + @accessor.should have_track(:version, [0,5,10]) + end + + === Deep clone? Works === method_missing? Fuck method_missing ;*. Just deal with it.