Skip to content

Commit

Permalink
Fix rspec-rails incompatbility with Rails 7
Browse files Browse the repository at this point in the history
rspec-rails v6.0.0.rc1 needs to be used to support `have_enqueued_email`
in Rails 7 (see rspec/rspec-rails#2546).
However, that would break tests for previous versions. On top of that,
`rspec-rails` dependency is transitive through `solidus_dev_support`,
which is not compatible with rsec-rails v6.0.0.rc1.
  • Loading branch information
waiting-for-dev committed May 4, 2022
1 parent 126f093 commit d1b25c2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions spec/models/spree/order_spec.rb
Expand Up @@ -45,19 +45,19 @@
it 'does not send the confirmation email' do
order = Spree::TestingSupport::OrderWalkthrough.up_to(:payment)

expect {
order.complete!
}.not_to have_enqueued_email(Spree::OrderMailer, 'confirm_email')
expect(Spree::OrderMailer).not_to receive(:confirm_email)

order.complete!
end
end

context 'when disable_builtin_emails is false', unless: ENV['DISABLE_BUILTIN_EMAILS'] do
it 'sends the confirmation email' do
order = Spree::TestingSupport::OrderWalkthrough.up_to(:payment)

expect {
order.complete!
}.to have_enqueued_email(Spree::OrderMailer, 'confirm_email')
expect(Spree::OrderMailer).to receive(:confirm_email).and_call_original

order.complete!
end
end
end
Expand All @@ -79,9 +79,9 @@
allow(SolidusTracking.configuration).to receive(:disable_builtin_emails).and_return(true)
order = create(:completed_order_with_totals)

expect {
order.canceled_by(create(:user))
}.not_to have_enqueued_email(Spree::OrderMailer, 'cancel_email')
expect(Spree::OrderMailer).not_to receive(:cancel_email)

order.canceled_by(create(:user))
end
end

Expand All @@ -90,9 +90,9 @@
allow(SolidusTracking.configuration).to receive(:disable_builtin_emails).and_return(false)
order = create(:completed_order_with_totals)

expect {
order.canceled_by(create(:user))
}.to have_enqueued_email(Spree::OrderMailer, 'cancel_email')
expect(Spree::OrderMailer).not_to receive(:cancel_email).and_call_original

order.canceled_by(create(:user))
end
end
end
Expand Down

0 comments on commit d1b25c2

Please sign in to comment.