diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index 5fc96c34c2..8e3c6b7bb4 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -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 diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index e72fc7a1c4..ab86be1580 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -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