diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ce4532274..a8a31e857 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -133,4 +133,8 @@ module ApplicationHelper featured_users_path end end + + def all_services_connected? + current_user.services.size == AppConfig[:configured_services].size + end end diff --git a/app/views/shared/_right_sections.html.haml b/app/views/shared/_right_sections.html.haml index 7f63584f8..788d0b193 100644 --- a/app/views/shared/_right_sections.html.haml +++ b/app/views/shared/_right_sections.html.haml @@ -22,7 +22,7 @@ = t('aspects.index.cubbies.explanation') = link_to t('aspects.index.cubbies.learn_more'), token_path -- unless AppConfig.configured_services.blank? +- unless AppConfig.configured_services.blank? || all_services_connected? .section .title = image_tag('/images/icons/monotone_wrench_settings.png') 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