mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix specs: Expect proper query chain
This commit is contained in:
@@ -6,7 +6,8 @@ describe HomeController do
|
||||
let!(:invisible_distributor) { create(:distributor_enterprise, visible: false) }
|
||||
|
||||
before do
|
||||
Enterprise.stub(:distributors_with_active_order_cycles).and_return [distributor]
|
||||
Enterprise.stub_chain(:distributors_with_active_order_cycles, :ready_for_checkout).
|
||||
and_return [distributor]
|
||||
end
|
||||
|
||||
it "sets active distributors" do
|
||||
|
||||
@@ -2,7 +2,13 @@ require 'spec_helper'
|
||||
|
||||
describe MapController do
|
||||
it "loads active distributors" do
|
||||
Enterprise.should_receive(:distributors_with_active_order_cycles)
|
||||
active_distributors = double(:distributors)
|
||||
|
||||
Enterprise.stub_chain(:distributors_with_active_order_cycles, :ready_for_checkout).
|
||||
and_return(active_distributors)
|
||||
|
||||
get :index
|
||||
|
||||
assigns(:active_distributors).should == active_distributors
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,8 +4,9 @@ describe ProducersController do
|
||||
let!(:distributor) { create(:distributor_enterprise) }
|
||||
|
||||
before do
|
||||
Enterprise.stub(:distributors_with_active_order_cycles).and_return [distributor]
|
||||
Enterprise.stub(:all).and_return [distributor]
|
||||
Enterprise.stub_chain(:distributors_with_active_order_cycles, :ready_for_checkout).
|
||||
and_return([distributor])
|
||||
Enterprise.stub(:all).and_return([distributor])
|
||||
end
|
||||
|
||||
it "sets active distributors" do
|
||||
|
||||
Reference in New Issue
Block a user