From a3b5ba2257aa8ddd7b60de8fe7350c9b04ce7f89 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Tue, 13 May 2014 16:38:52 +1000 Subject: [PATCH] Adding a spec for visiblity filtering --- spec/controllers/home_controller_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 2f4ad05d8f..babb1c84e6 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -2,17 +2,22 @@ require 'spec_helper' describe HomeController do render_views - let(:distributor) { create(:distributor_enterprise) } + let!(:distributor) { create(:distributor_enterprise) } + let!(:invisible_distributor) { create(:distributor_enterprise, visible: false) } before do - controller.stub(:load_data_for_sidebar).and_return nil Enterprise.stub(:distributors_with_active_order_cycles).and_return [distributor] - Enterprise.stub(:is_distributor).and_return [distributor] end + it "sets active distributors" do get :index assigns[:active_distributors].should == [distributor] end + + it "does not show invisible hubs" do + get :index + response.body.should_not have_content invisible_distributor.name + end # This is done inside the json/hubs RABL template it "gets the next order cycle for each hub" do