Skip to content
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 #1716

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/app/assets/javascripts/spree/backend/shipments.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var ShipShipmentView = Backbone.View.extend({
type: "PUT",
url: Spree.routes.shipments_api + "/" + this.shipment_number + "/ship",
data: {
send_mailer: this.$("[name='send_mailer']").val()
send_mailer: this.$("[name='send_mailer']").is(":checked")
},
success: function(){
window.location.reload()
Expand Down
16 changes: 15 additions & 1 deletion backend/spec/features/admin/orders/shipments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,26 @@
end
end

it "can ship a completed order" do
def ship_shipment
find(".ship-shipment-button").click

expect(page).to have_content("shipped package")
expect(order.reload.shipment_state).to eq("shipped")
end

it "can ship a completed order" do
expect {
ship_shipment
}.to change{ ActionMailer::Base.deliveries.count }.by(1)
end

it "doesn't send a shipping confirmation email when ask to suppress the mailer" do
uncheck 'Send Mailer'

expect {
ship_shipment
}.not_to change{ ActionMailer::Base.deliveries.count }
end
end

context "moving variants between shipments", js: true do
Expand Down