Skip to content

Commit

Permalink
Merge branch 'master' into rails-5-fix-discussion-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
yuenmichelle1 authored Jul 3, 2024
2 parents 6a7c851 + 569f9fe commit 2468b75
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
15 changes: 11 additions & 4 deletions spec/models/group_mention_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
13 changes: 10 additions & 3 deletions spec/models/mention_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 9 additions & 2 deletions spec/models/moderation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2468b75

Please sign in to comment.