From e7c6892ab804b62a19f2d84dbd8302fb2cc51ae5 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Thu, 9 May 2019 23:47:32 +0100 Subject: [PATCH] Run transpec for spec/mailers --- spec/mailers/order_mailer_spec.rb | 12 ++++++------ spec/mailers/producer_mailer_spec.rb | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/spec/mailers/order_mailer_spec.rb b/spec/mailers/order_mailer_spec.rb index 30e90ebd0f..aaa436cea6 100644 --- a/spec/mailers/order_mailer_spec.rb +++ b/spec/mailers/order_mailer_spec.rb @@ -27,28 +27,28 @@ describe Spree::OrderMailer do describe "for customers" do it "should send an email to the customer when given an order" do Spree::OrderMailer.confirm_email_for_customer(@order1.id).deliver - ActionMailer::Base.deliveries.count.should == 1 - ActionMailer::Base.deliveries.first.to.should == [@order1.email] + expect(ActionMailer::Base.deliveries.count).to eq(1) + expect(ActionMailer::Base.deliveries.first.to).to eq([@order1.email]) end it "sets a reply-to of the enterprise email" do Spree::OrderMailer.confirm_email_for_customer(@order1.id).deliver - ActionMailer::Base.deliveries.first.reply_to.should == [@distributor.contact.email] + expect(ActionMailer::Base.deliveries.first.reply_to).to eq([@distributor.contact.email]) end end describe "for shops" do it "sends an email to the shop owner when given an order" do Spree::OrderMailer.confirm_email_for_shop(@order1.id).deliver - ActionMailer::Base.deliveries.count.should == 1 - ActionMailer::Base.deliveries.first.to.should == [@distributor.contact.email] + expect(ActionMailer::Base.deliveries.count).to eq(1) + expect(ActionMailer::Base.deliveries.first.to).to eq([@distributor.contact.email]) end it "sends an email even if a footer_email is given" do # Testing bug introduced by a9c37c162e1956028704fbdf74ce1c56c5b3ce7d ContentConfig.footer_email = "email@example.com" Spree::OrderMailer.confirm_email_for_shop(@order1.id).deliver - ActionMailer::Base.deliveries.count.should == 1 + expect(ActionMailer::Base.deliveries.count).to eq(1) end end end diff --git a/spec/mailers/producer_mailer_spec.rb b/spec/mailers/producer_mailer_spec.rb index 17712141e5..5d2b13f45f 100644 --- a/spec/mailers/producer_mailer_spec.rb +++ b/spec/mailers/producer_mailer_spec.rb @@ -50,7 +50,7 @@ describe ProducerMailer, type: :mailer do let(:mail) { ProducerMailer.order_cycle_report(s1, order_cycle) } it "should send an email when an order cycle is closed" do - ActionMailer::Base.deliveries.count.should == 1 + expect(ActionMailer::Base.deliveries.count).to eq(1) end it "sets a reply-to of the oc coordinator's email" do @@ -58,7 +58,7 @@ describe ProducerMailer, type: :mailer do end it "includes receival instructions" do - mail.body.encoded.should include 'Outside shed.' + expect(mail.body.encoded).to include 'Outside shed.' end it "cc's the oc coordinator" do @@ -68,32 +68,32 @@ describe ProducerMailer, type: :mailer do it "contains an aggregated list of produce in alphabetical order" do expect(mail.body.encoded).to match(/coffee.+\n.+Zebra/) body_lines_including(mail, p1.name).each do |line| - line.should include 'QTY: 3' - line.should include '@ $10.00 = $30.00' + expect(line).to include 'QTY: 3' + expect(line).to include '@ $10.00 = $30.00' end - body_as_html(mail).find("table.order-summary tr", text: p1.name) - .should have_selector("td", text: "$30.00") + expect(body_as_html(mail).find("table.order-summary tr", text: p1.name)) + .to have_selector("td", text: "$30.00") end it "displays tax totals for each product" do # Tax for p1 line items - body_as_html(mail).find("table.order-summary tr", text: p1.name) - .should have_selector("td.tax", text: "$2.73") + expect(body_as_html(mail).find("table.order-summary tr", text: p1.name)) + .to have_selector("td.tax", text: "$2.73") end it "does not include incomplete orders" do - mail.body.encoded.should_not include p3.name + expect(mail.body.encoded).not_to include p3.name end it "does not include canceled orders" do - mail.body.encoded.should_not include p5.name + expect(mail.body.encoded).not_to include p5.name end it "includes the total" do - mail.body.encoded.should include 'Total: $50.00' - body_as_html(mail).find("tr.total-row") - .should have_selector("td", text: "$50.00") + expect(mail.body.encoded).to include 'Total: $50.00' + expect(body_as_html(mail).find("tr.total-row")) + .to have_selector("td", text: "$50.00") end it "sends no mail when the producer has no orders" do