Skip to content

Commit

Permalink
Rails 5.2 specs - Remove calling run_callbacks commit spec workarounds (
Browse files Browse the repository at this point in the history
#378)

* ensure creation when testing after_commit callbacks

* remove run_callbacks workaround on specs, after_commit specs should work without calling callback in Rails 5+

* remove accidental secondary creation
  • Loading branch information
yuenmichelle1 authored Oct 23, 2024
1 parent 426d4f7 commit 3b7f876
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions spec/models/announcement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
end

context 'creating' do
let(:announcement){ create :announcement }
let(:announcement){ build :announcement }
it 'should publish' do
expect(AnnouncementWorker).to receive :perform_async
announcement.run_callbacks :commit
announcement.save!
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/notification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
end

context 'creating' do
let(:notification){ create :notification }
let(:notification){ build :notification }
it 'should publish' do
expect(NotificationWorker).to receive :perform_async
notification.run_callbacks :commit
notification.save!
end
end

Expand Down

0 comments on commit 3b7f876

Please sign in to comment.