Sha256: e02ea3f831e835c609d08be4140cd9aa061d8c6819a523826fd22dcb2c8c4bca

Contents?: true

Size: 939 Bytes

Versions: 1

Compression:

Stored size: 939 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "ObjectHistory" do

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

  it "rspec matcher should work" do
    3.times {@track_object.add_one}
    @track_object.should have_track(:number, [0,1,2,3])
  end

  it "should work with blocks" do
    3.times do
      @track_object.add_one do |track_obj|
        track_obj.number += 1
      end
    end
    @track_object.should have_track(:number, [0,2,4,6])
  end

  context "deep clone" do

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

    it "should work with deep clone object" do
      3.times do
        @track_object.add_one
      end

      4.times do
        @track_object.track_object.add_one
      end

      @track_object.should have_track(:number, [0,1,2,3])
      @track_object.track_object.should have_track(:number, [0,1,2,3,4])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object-history-0.0.1 spec/object-history_spec.rb