Removing unrequired Spree::Order#with_payment_method_name scope

This commit is contained in:
Rob Harrington
2016-03-18 17:03:23 +11:00
parent 9b5bfdeb00
commit 0ed97d820c
2 changed files with 0 additions and 34 deletions

View File

@@ -70,13 +70,6 @@ Spree::Order.class_eval do
where("state != ?", state)
}
scope :with_payment_method_name, lambda { |payment_method_name|
joins(:payments => :payment_method).
where('spree_payment_methods.name IN (?)', payment_method_name).
select('DISTINCT spree_orders.*')
}
# -- Methods
def products_available_from_new_distribution
# Check that the line_items in the current order are available from a newly selected distribution

View File

@@ -489,33 +489,6 @@ describe Spree::Order do
Spree::Order.not_state(:canceled).should_not include o
end
end
describe "with payment method names" do
let!(:o1) { create(:order) }
let!(:o2) { create(:order) }
let!(:pm1) { create(:payment_method, name: 'foo') }
let!(:pm2) { create(:payment_method, name: 'bar') }
let!(:p1) { create(:payment, order: o1, payment_method: pm1) }
let!(:p2) { create(:payment, order: o2, payment_method: pm2) }
it "returns the order with payment method name when one specified" do
Spree::Order.with_payment_method_name('foo').should == [o1]
end
it "returns the orders with payment method name when many specified" do
Spree::Order.with_payment_method_name(['foo', 'bar']).should include o1, o2
end
it "doesn't return rows with a different payment method name" do
Spree::Order.with_payment_method_name('foobar').should_not include o1
Spree::Order.with_payment_method_name('foobar').should_not include o2
end
it "doesn't return duplicate rows" do
p2 = FactoryGirl.create(:payment, order: o1, payment_method: pm1)
Spree::Order.with_payment_method_name('foo').length.should == 1
end
end
end
describe "shipping address prepopulation" do