Sha256: 8e59dd596da3d350b3982ba9aa9974a3de761db6f91b89ab28ce84948842a024

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

= object-history

Test your objects with history path.
http://travis-ci.org/LTe/object-history.png

== Instalation
Add to your Gemfile
  gem 'object-history'

== How to use
Just include *ObjectHistory* to class.
  class TrackedObject
    include ObjectHistory
  end

And on bottom of class add the methods that you want to track
  class TrackedObject
    include ObjectHistory
    track_history_of :your_method
  end

== Example
  class TrackedObject
    attr_accessor :number

    def initialize(child = nil)
      @number = 0
    end

    def add_one(*args, &block)
      @number += 1
      block.call(self) if block_given?
    end

    include ObjectHistory
    track_history_of :add_one
  end

After that you can test with rspec using *have_track* matcher ;-)

  describe TrackObject do
    before(:each) do
      @track_object = TrackObject.new
    end

    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

=== Deep clone?
Works
=== method_missing?
Fuck method_missing ;*. Just deal with it.


== Contributing to object-history

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2011 Piotr Niełacny. See LICENSE.txt for
further details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object-history-0.0.1 README.rdoc