mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Add controller spec for deselecting distributors
This commit is contained in:
@@ -4,13 +4,32 @@ require 'spree/core/current_order'
|
||||
describe Spree::DistributorsController do
|
||||
include Spree::Core::CurrentOrder
|
||||
|
||||
before do
|
||||
stub!(:before_save_new_order)
|
||||
stub!(:after_save_new_order)
|
||||
end
|
||||
|
||||
|
||||
it "selects distributors" do
|
||||
d = create(:distributor)
|
||||
|
||||
spree_get :select, :id => d.id
|
||||
response.should be_redirect
|
||||
|
||||
order = current_order(false)
|
||||
order.distributor.should == d
|
||||
end
|
||||
|
||||
it "deselects distributors" do
|
||||
d = create(:distributor)
|
||||
order = current_order(true)
|
||||
order.distributor = d
|
||||
order.save!
|
||||
|
||||
spree_get :deselect
|
||||
response.should be_redirect
|
||||
|
||||
order.reload
|
||||
order.distributor.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user