Skip to content

Commit

Permalink
Removing unrequired Spree::Order#with_payment_method_name scope
Browse files Browse the repository at this point in the history
  • Loading branch information
oeoeaio committed Apr 1, 2016
1 parent 9b5bfde commit 0ed97d8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
7 changes: 0 additions & 7 deletions app/models/spree/order_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@
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
Expand Down
27 changes: 0 additions & 27 deletions spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -489,33 +489,6 @@
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
Expand Down

0 comments on commit 0ed97d8

Please sign in to comment.