diff --git a/spec/models/group_mention_spec.rb b/spec/models/group_mention_spec.rb index 23b1efcb..20896cc0 100644 --- a/spec/models/group_mention_spec.rb +++ b/spec/models/group_mention_spec.rb @@ -4,7 +4,7 @@ context 'validating' do it 'should require a comment' do without_comment = build :group_mention, comment: nil - expect(without_comment).to fail_validation comment: "can't be blank" + expect(without_comment).to fail_validation end it 'should require a section' do @@ -65,9 +65,16 @@ describe '#notify_later' do it 'should queue the notification' do - group_mention = create :group_mention - expect(GroupMentionWorker).to receive(:perform_async).with group_mention.id - group_mention.run_callbacks :commit + # TODO: Once on Rails 5, Can Remove this Version Check + if Rails.version.starts_with?('5') + group_mention = build :group_mention + expect(GroupMentionWorker).to receive(:perform_async) + group_mention.save! + else + group_mention = create :group_mention + expect(GroupMentionWorker).to receive(:perform_async).with group_mention.id + group_mention.run_callbacks :commit + end end end diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index 9488343c..3cacfe3f 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -30,9 +30,16 @@ describe '#notify_later' do it 'should queue the notification' do - mention = create :mention, mentionable: focus - expect(MentionWorker).to receive(:perform_async).with mention.id - mention.run_callbacks :commit + # TODO: Once on Rails 5, Can Remove this Version Check + if Rails.version.starts_with?('5') + mention = build :mention, mentionable: focus + expect(MentionWorker).to receive(:perform_async) + mention.save! + else + mention = create :mention, mentionable: focus + expect(MentionWorker).to receive(:perform_async).with mention.id + mention.run_callbacks :commit + end end end diff --git a/spec/models/moderation_spec.rb b/spec/models/moderation_spec.rb index 81bb949d..1d595be8 100644 --- a/spec/models/moderation_spec.rb +++ b/spec/models/moderation_spec.rb @@ -104,8 +104,15 @@ include_context 'moderation subscriptions' it 'should queue the notification' do - expect(ModerationNotificationWorker).to receive(:perform_async).with moderation.id - moderation.run_callbacks :commit + # TODO: Once on Rails 5, Can Remove this Version Check + if Rails.version.starts_with?('5') + new_moderation = build :moderation, section: 'project-1' + expect(ModerationNotificationWorker).to receive(:perform_async) + new_moderation.save! + else + expect(ModerationNotificationWorker).to receive(:perform_async).with moderation.id + moderation.run_callbacks :commit + end end end