From 6a56e3298c36fdb4306433a29611fbf95c23a429 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 3 Aug 2011 19:02:47 -0700 Subject: only show connect to services if all services not already connected --- spec/helpers/application_helper_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'spec') diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index fd05d3631..2c393e36d 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -77,4 +77,25 @@ describe ApplicationHelper do contacts_link.should == contacts_path end end + + describe "#all_services_connected?" do + before do + AppConfig[:configured_services] = [1, 2, 3] + + def current_user + @current_user + end + @current_user = alice + end + + it 'returns true if all networks are connected' do + 3.times { |t| @current_user.services << Factory.build(:service) } + all_services_connected?.should be_true + end + + it 'returns false if not all networks are connected' do + @current_user.services.delete_all + all_services_connected?.should be_false + end + end end -- cgit v1.2.3