spec/integration/integration_spec.rb in mongoid-history-0.8.1 vs spec/integration/integration_spec.rb in mongoid-history-0.8.2
- old
+ new
@@ -948,7 +948,29 @@
expect(sausage.history_tracks.last.action).to eq('destroy')
sausage.history_tracks.last.undo! user
expect(sausage.reload.flavour).to eq('Guinness')
end
end
+
+ describe 'changing collection' do
+ before :each do
+ class Fish
+ include Mongoid::Document
+ include Mongoid::History::Trackable
+
+ track_history on: [:species], modifier_field_optional: true
+ store_in collection: :animals
+
+ field :species
+ end
+ end
+
+ after :each do
+ Object.send(:remove_const, :Fish)
+ end
+
+ it 'should track history' do
+ Fish.new.save!
+ end
+ end
end
end