diff --git a/spec/integration/multiple_trackers_spec.rb b/spec/integration/multiple_trackers_spec.rb index 55514aa6..3a315dd9 100644 --- a/spec/integration/multiple_trackers_spec.rb +++ b/spec/integration/multiple_trackers_spec.rb @@ -4,28 +4,30 @@ before :all do Mongoid::History.tracker_class_name = nil - class First - include Mongoid::Document - include Mongoid::History::Trackable + module MultipleTrackersSpec + class First + include Mongoid::Document + include Mongoid::History::Trackable - field :text, type: String - track_history on: [:text], - track_create: true, - track_update: true, - track_destroy: true, - tracker_class_name: :first_history_tracker - end + field :text, type: String + track_history on: [:text], + track_create: true, + track_update: true, + track_destroy: true, + tracker_class_name: :first_history_tracker + end - class Second - include Mongoid::Document - include Mongoid::History::Trackable + class Second + include Mongoid::Document + include Mongoid::History::Trackable - field :text, type: String - track_history on: [:text], - track_create: true, - track_update: true, - track_destroy: true, - tracker_class_name: :second_history_tracker + field :text, type: String + track_history on: [:text], + track_create: true, + track_update: true, + track_destroy: true, + tracker_class_name: :second_history_tracker + end end class FirstHistoryTracker @@ -40,13 +42,13 @@ class SecondHistoryTracker it 'should be possible to have different trackers for each class' do expect(FirstHistoryTracker.count).to eq(0) expect(SecondHistoryTracker.count).to eq(0) - expect(First.tracker_class).to be FirstHistoryTracker - expect(Second.tracker_class).to be SecondHistoryTracker + expect(MultipleTrackersSpec::First.tracker_class).to be FirstHistoryTracker + expect(MultipleTrackersSpec::Second.tracker_class).to be SecondHistoryTracker - foo = First.new + foo = MultipleTrackersSpec::First.new foo.save - bar = Second.new + bar = MultipleTrackersSpec::Second.new bar.save expect(FirstHistoryTracker.count).to eq 1