diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-09-06 03:02:11 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-09-06 22:07:21 +0300 |
commit | f25b5b7f8db05ec441574429e024c71893fa7c11 (patch) | |
tree | 8270555cadd697963bc7585b582e0e9c9d2ac2cc /spec/views | |
parent | edf8dd44f7676d14fda5ce305c2c3e31b8c14c17 (diff) |
Fix “Share lock” help text
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/groups/edit.html.haml_spec.rb | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/spec/views/groups/edit.html.haml_spec.rb b/spec/views/groups/edit.html.haml_spec.rb index 613368049e1..86bb28a43c1 100644 --- a/spec/views/groups/edit.html.haml_spec.rb +++ b/spec/views/groups/edit.html.haml_spec.rb @@ -6,8 +6,6 @@ describe 'groups/edit.html.haml' do describe 'Share lock option' do let(:root_owner) { create(:user) } let(:root_group) { create(:group) } - let(:expected_label) { default_label } - let(:expected_help) { default_help } before do root_group.add_owner(root_owner) @@ -16,14 +14,16 @@ describe 'groups/edit.html.haml' do shared_examples_for 'share lock option' do |checkbox_options| it 'should have the correct label, help text, and checkbox options' do assign(:group, test_group) - allow(view).to receive(:can?).and_return(true) + allow(view).to receive(:can?).with(test_user, :admin_group, test_group).and_return(true) allow(view).to receive(:can_change_group_visibility_level?).and_return(false) allow(view).to receive(:current_user).and_return(test_user) + expect(view).to receive(:can_change_share_with_group_lock?).and_return(!checkbox_options[:disabled]) + expect(view).to receive(:share_with_group_lock_help_text).and_return('help text here') render - expect(rendered).to have_content(expected_label) - expect(rendered).to have_css('.descr', text: expected_help) + expect(rendered).to have_content("Prevent sharing a project within #{test_group.name} with other groups") + expect(rendered).to have_css('.descr', text: 'help text here') expect(rendered).to have_field('group_share_with_group_lock', checkbox_options) end end @@ -82,14 +82,12 @@ describe 'groups/edit.html.haml' do context 'when the subgroup has "Share lock" disabled (parent overridden)' do context 'as the root_owner' do let(:test_user) { root_owner } - let(:expected_help) { parent_locked_and_has_been_overridden } it_behaves_like 'share lock option', { disabled: false, checked: false } end context 'as the sub_owner' do let(:test_user) { sub_owner } - let(:expected_help) { parent_locked_and_has_been_overridden } it_behaves_like 'share lock option', { disabled: false, checked: false } end @@ -102,39 +100,17 @@ describe 'groups/edit.html.haml' do context 'as the root_owner' do let(:test_user) { root_owner } - let(:expected_help) { parent_locked_but_you_can_override } it_behaves_like 'share lock option', { disabled: false, checked: true } end context 'as the sub_owner' do let(:test_user) { sub_owner } - let(:expected_help) { parent_locked_so_ask_the_owner } it_behaves_like 'share lock option', { disabled: true, checked: true } end end end end - - def default_label - "Prevent sharing a project within #{test_group.name} with other groups" - end - - def default_help - "This setting will be applied to all subgroups unless overridden by a group owner." - end - - def parent_locked_but_you_can_override - "This setting is applied on #{test_group.parent.name}. You can override the setting or remove the share lock from the parent group." - end - - def parent_locked_so_ask_the_owner - "This setting is applied on #{test_group.parent.name}. To share this group with another group, ask the owner to override the setting or remove the share lock from the parent group." - end - - def parent_locked_and_has_been_overridden - "This setting is applied on #{test_group.parent.name} and has been overridden on this subgroup." - end end end |