Skip to content

Commit

Permalink
Replace outdated Spree::Config[:mails_from] with Spree::Store.current…
Browse files Browse the repository at this point in the history
….mail_from_address.

Fixes spree#6096
Fixes spree#6097
  • Loading branch information
romul authored and Jeff Dutil committed Mar 9, 2015
1 parent af4a53f commit 2901d4c
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 10 deletions.
2 changes: 0 additions & 2 deletions api/spec/controllers/spree/api/v1/orders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,6 @@ def clean_address(address)

context "can cancel an order" do
before do
Spree::Config[:mails_from] = "spree@example.com"

order.completed_at = Time.now
order.state = 'complete'
order.shipment_state = 'ready'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@
context "can transition a shipment from ready to ship" do
before do
allow_any_instance_of(Spree::Order).to receive_messages(:paid? => true, :complete? => true)
# For the shipment notification email
Spree::Config[:mails_from] = "spree@example.com"

shipment.update!(shipment.order)
expect(shipment.state).to eq("ready")
allow_any_instance_of(Spree::ShippingRate).to receive_messages(:cost => 5)
Expand Down
2 changes: 2 additions & 0 deletions backend/spec/features/admin/orders/new_order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
stub_authorization!

before do
# create default store
create(:store)
visit spree.new_admin_order_path
end

Expand Down
2 changes: 1 addition & 1 deletion core/app/mailers/spree/base_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Spree
class BaseMailer < ActionMailer::Base

def from_address
Spree::Config[:mails_from]
Spree::Store.current.mail_from_address
end

def money(amount, currency = Spree::Config[:currency])
Expand Down
5 changes: 5 additions & 0 deletions core/lib/spree/testing_support/order_walkthrough.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
class OrderWalkthrough
def self.up_to(state)
# A default store must exist to provide store settings
unless Spree::Store.exists?
FactoryGirl.create(:store)
end

# A payment method must exist for an order to proceed through the Address state
unless Spree::PaymentMethod.exists?
FactoryGirl.create(:check_payment_method)
Expand Down
2 changes: 1 addition & 1 deletion core/spec/mailers/order_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
context ":from not set explicitly" do
it "falls back to spree config" do
message = Spree::OrderMailer.confirm_email(order)
expect(message.from).to eq([Spree::Config[:mails_from]])
expect(message.from).to eq([Spree::Store.current.mail_from_address])
end
end

Expand Down
2 changes: 1 addition & 1 deletion core/spec/mailers/reimbursement_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
context ":from not set explicitly" do
it "falls back to spree config" do
message = Spree::ReimbursementMailer.reimbursement_email(reimbursement)
expect(message.from).to eq [Spree::Config[:mails_from]]
expect(message.from).to eq [Spree::Store.current.mail_from_address]
end
end

Expand Down
2 changes: 1 addition & 1 deletion core/spec/mailers/shipment_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
context ":from not set explicitly" do
it "falls back to spree config" do
message = Spree::ShipmentMailer.shipped_email(shipment)
expect(message.from).to eq([Spree::Config[:mails_from]])
expect(message.from).to eq([Spree::Store.current.mail_from_address])
end
end

Expand Down
2 changes: 1 addition & 1 deletion core/spec/mailers/test_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
context ":from not set explicitly" do
it "falls back to spree config" do
message = Spree::TestMailer.test_email('test@example.com')
expect(message.from).to eq([Spree::Config[:mails_from]])
expect(message.from).to eq([Spree::Store.current.mail_from_address])
end
end

Expand Down
1 change: 1 addition & 0 deletions frontend/spec/features/coupon_code_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
let!(:shipping_method) { create(:shipping_method) }
let!(:payment_method) { create(:check_payment_method) }
let!(:product) { create(:product, name: "RoR Mug", price: 20) }
let!(:store) { create(:store) }

context "visitor makes checkout as guest without registration" do
def create_basic_coupon_promotion(code)
Expand Down
1 change: 1 addition & 0 deletions frontend/spec/support/shared_contexts/checkout_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
let!(:mug) { create(:product, name: "RoR Mug") }
let!(:payment_method) { create(:check_payment_method) }
let!(:zone) { create(:zone) }
let!(:store) { create(:store) }
end

0 comments on commit 2901d4c

Please sign in to comment.