-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the 'Send Mailer' checkbox selection #1659
Fix the 'Send Mailer' checkbox selection #1659
Conversation
also #1659 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. The link is currently an infinite loop.
lol... of course! this wasn't meant to be posted here. Sorry about the confusion. |
expect { | ||
find(".ship-shipment-button").click | ||
wait_for_ajax | ||
}.not_to change{ ActionMailer::Base.deliveries.count } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of the test.
It's testing with .not_to
without a corresponding test to check when it does change. For all we know, it could not deliver anything, or this test isn't configured correctly and we wouldn't know it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can wrap the test above this one (it "can ship a completed order"
) with the opposite email expectation. You'll probably want to rebase first, since that spec was changed in #1668
it "can ship a completed order" do
expect {
find(".ship-shipment-button").click
expect(page).to have_content("shipped package")
expect(order.reload.shipment_state).to eq("shipped")
}.to change{ ActionMailer::Base.deliveries.count }.by(1)
end
|
||
expect { | ||
find(".ship-shipment-button").click | ||
wait_for_ajax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see the wait_for_ajax
eliminated. We should expect something on the page to happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbrunsdon has removed all the wait_for_ajax
in #1668 🎉.
We can replace the wait_for_ajax
here with expect(page).to have_content("shipped package")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the bug report and patch. I left a couple of suggestions with which I think we can get this merged :)
@@ -37,6 +37,15 @@ | |||
expect(page).to have_content("shipped package") | |||
expect(order.reload.shipment_state).to eq("shipped") | |||
end | |||
|
|||
it "doesn't send a shipping confirmation email when ask to suppress the mailer" do | |||
find("#send_mailer").set(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be uncheck 'Send Mailer'
, which reads a little nicer :)
|
||
expect { | ||
find(".ship-shipment-button").click | ||
wait_for_ajax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbrunsdon has removed all the wait_for_ajax
in #1668 🎉.
We can replace the wait_for_ajax
here with expect(page).to have_content("shipped package")
expect { | ||
find(".ship-shipment-button").click | ||
wait_for_ajax | ||
}.not_to change{ ActionMailer::Base.deliveries.count } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can wrap the test above this one (it "can ship a completed order"
) with the opposite email expectation. You'll probably want to rebase first, since that spec was changed in #1668
it "can ship a completed order" do
expect {
find(".ship-shipment-button").click
expect(page).to have_content("shipped package")
expect(order.reload.shipment_state).to eq("shipped")
}.to change{ ActionMailer::Base.deliveries.count }.by(1)
end
The user selection for suppressing the shipping confirmation email is not respected when shipping a package from the admin. It always sends it.