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

Spree 2 Upgrade - MailMethod - Fix "undefined mail method" error in specs #2588

Merged
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
5 changes: 1 addition & 4 deletions spec/controllers/admin/subscriptions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,7 @@

context "when at least one associate orders is 'canceled'" do
before do
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: '[email protected]'
)
Spree::Config[:mails_from] = "[email protected]"
proxy_order.cancel
end

Expand Down
5 changes: 1 addition & 4 deletions spec/controllers/spree/admin/orders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ def self.make_simple_data!
context "when the distributor's ABN has been set" do
before { distributor.update_attribute(:abn, "123") }
before do
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: '[email protected]'
)
Spree::Config[:mails_from] = "[email protected]"
end
it "should allow me to send order invoices" do
expect do
Expand Down
5 changes: 1 addition & 4 deletions spec/controllers/spree/orders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,7 @@
let(:order) { create(:completed_order_with_totals, user: user) }

before do
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: '[email protected]'
)
Spree::Config[:mails_from] = "[email protected]"
end

it "responds with success" do
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/user_passwords_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
end

it "renders Darkswarm" do
Spree::MailMethod.create!(environment: 'test')
clear_jobs

user.send_reset_password_instructions
Expand Down
5 changes: 1 addition & 4 deletions spec/features/consumer/shopping/orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@

context "when the distributor allows changes to be made to orders" do
before do
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: '[email protected]'
)
Spree::Config[:mails_from] = "[email protected]"
end
before do
order.distributor.update_attributes(allow_order_changes: true)
Expand Down
1 change: 0 additions & 1 deletion spec/mailers/enterprise_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

before do
ActionMailer::Base.deliveries = []
Spree::MailMethod.create!(environment: 'test')
end

describe "#welcome" do
Expand Down
5 changes: 1 addition & 4 deletions spec/mailers/producer_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

describe ProducerMailer do
before do
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: '[email protected]'
)
Spree::Config[:mails_from] = "[email protected]"
end
let!(:zone) { create(:zone_with_member) }
let!(:tax_rate) { create(:tax_rate, included_in_price: true, calculator: Spree::Calculator::DefaultTax.new, zone: zone, amount: 0.1) }
Expand Down
2 changes: 0 additions & 2 deletions spec/mailers/user_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []

Spree::MailMethod.create!(environment: 'test')
end

it "sends an email when given a user" do
Expand Down
7 changes: 2 additions & 5 deletions spec/models/order_cycle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -525,16 +525,13 @@
let!(:order5) { create(:completed_order_with_totals, distributor: shop, user: user, order_cycle: oc) }

before do
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: '[email protected]'
)
Spree::Config[:mails_from] = "[email protected]"
end
before { order5.cancel }

it "only returns items from non-cancelled orders in the OC, placed by the user at the shop" do
items = oc.items_bought_by_user(user, shop)
expect(items).to eq order1.reload.line_items
expect(items).to match_array order1.reload.line_items
end
end
end
5 changes: 1 addition & 4 deletions spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,7 @@
describe "scopes" do
describe "not_state" do
before do
Spree::MailMethod.create!(
environment: Rails.env,
preferred_mails_from: '[email protected]'
)
Spree::Config[:mails_from] = "[email protected]"
end

it "finds only orders not in specified state" do
Expand Down