Sha256: 37e91c9dd352f3c3b200a9a789f4b58241baa2c8755fc5d59746c949e5416c6b
Contents?: true
Size: 762 Bytes
Versions: 3
Compression:
Stored size: 762 Bytes
Contents
require 'spec_helper' describe Mongoid::History::Tracker do before :all do class Element include Mongoid::Document include Mongoid::Timestamps include Mongoid::History::Trackable field :body track_history on: [:body], track_create: true, track_update: true, track_destroy: true end class Prompt < Element end end it "tracks subclass create and update" do prompt = Prompt.new expect { prompt.save! }.to change(Tracker, :count).by(1) expect { prompt.update_attributes!(body: "one") }.to change(Tracker, :count).by(1) prompt.undo! prompt.body.should be_blank prompt.redo! nil, 2 prompt.body.should == "one" expect { prompt.destroy }.to change(Tracker, :count).by(1) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-history-0.4.4 | spec/integration/subclasses_spec.rb |
mongoid-history-0.4.3 | spec/integration/subclasses_spec.rb |
mongoid-history-0.4.2 | spec/integration/subclasses_spec.rb |