Sha256: a02be2495f49d80ca691afa38beb15518c5b8489da56ea6014e38b55c7a18a7d
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require 'spec_helper' describe Mongoid::History::Tracker do context 'when track_history not called' do before :each do class NotModel include Mongoid::Document include Mongoid::History::Trackable field :foo end end after :each do Object.send(:remove_const, :NotModel) end it 'should not track fields' do expect(NotModel.respond_to?(:tracked?)).to be false end end context 'boefore field' do before :each do class InsideBeforeModel include Mongoid::Document include Mongoid::History::Trackable track_history on: :fields field :foo end end after :each do Object.send(:remove_const, :InsideBeforeModel) end it 'should track fields' do expect(InsideBeforeModel.tracked?(:foo)).to be true end end context 'when track_history called inside class and after fields' do before :each do class InsideAfterModel include Mongoid::Document include Mongoid::History::Trackable field :foo track_history on: :fields end end after :each do Object.send(:remove_const, :InsideAfterModel) end it 'should track fields' do expect(InsideAfterModel.tracked?(:foo)).to be true end end context 'when track_history called outside class' do before :each do class OutsideModel include Mongoid::Document include Mongoid::History::Trackable field :foo end end after :each do Object.send(:remove_const, :OutsideModel) end it 'should track fields' do OutsideModel.track_history on: :fields expect(OutsideModel.tracked?(:foo)).to be true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-history-0.8.5 | spec/integration/track_history_order_spec.rb |