diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 5cd2b0cda8..16367eb812 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -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 diff --git a/spec/controllers/map_controller_spec.rb b/spec/controllers/map_controller_spec.rb index f3d56853f9..c4e98def8a 100644 --- a/spec/controllers/map_controller_spec.rb +++ b/spec/controllers/map_controller_spec.rb @@ -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 diff --git a/spec/controllers/producers_controller_spec.rb b/spec/controllers/producers_controller_spec.rb index 812b08892f..2b7377a471 100644 --- a/spec/controllers/producers_controller_spec.rb +++ b/spec/controllers/producers_controller_spec.rb @@ -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