diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-05-28 18:02:04 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-05-28 18:02:04 +0300 |
commit | fcdf3931811845ee7b214ab8ad97118d7eb7adb8 (patch) | |
tree | b48cdf0bf1f631a9ea2bafeca9e8cbeeed7286d0 /spec | |
parent | ba6384e7c7aedc2402fee8d6f2feeee743e5c14f (diff) |
Fix tests after group settings page redesign
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/groups/group_settings_spec.rb | 21 | ||||
-rw-r--r-- | spec/features/groups/share_lock_spec.rb | 31 | ||||
-rw-r--r-- | spec/features/groups_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/uploads/user_uploads_avatar_to_group_spec.rb | 4 |
4 files changed, 40 insertions, 18 deletions
diff --git a/spec/features/groups/group_settings_spec.rb b/spec/features/groups/group_settings_spec.rb index 1ce30015e81..bf329b0bb94 100644 --- a/spec/features/groups/group_settings_spec.rb +++ b/spec/features/groups/group_settings_spec.rb @@ -83,7 +83,7 @@ feature 'Edit group settings' do attach_file(:group_avatar, Rails.root.join('spec', 'fixtures', 'banana_sample.gif')) - expect { click_button 'Save group' }.to change { group.reload.avatar? }.to(true) + expect { save_group }.to change { group.reload.avatar? }.to(true) end it 'uploads new group avatar' do @@ -97,10 +97,19 @@ feature 'Edit group settings' do expect(page).not_to have_link('Remove avatar') end end -end -def update_path(new_group_path) - visit edit_group_path(group) - fill_in 'group_path', with: new_group_path - click_button 'Save group' + def update_path(new_group_path) + visit edit_group_path(group) + + page.within('.gs-advanced') do + fill_in 'group_path', with: new_group_path + click_button 'Change group path' + end + end + + def save_group + page.within('.gs-general') do + click_button 'Save group' + end + end end diff --git a/spec/features/groups/share_lock_spec.rb b/spec/features/groups/share_lock_spec.rb index 8842d1391aa..cefbc15e068 100644 --- a/spec/features/groups/share_lock_spec.rb +++ b/spec/features/groups/share_lock_spec.rb @@ -15,9 +15,8 @@ feature 'Group share with group lock' do context 'when enabling the parent group share with group lock' do scenario 'the subgroup share with group lock becomes enabled' do visit edit_group_path(root_group) - check 'group_share_with_group_lock' - click_on 'Save group' + enable_group_lock expect(subgroup.reload.share_with_group_lock?).to be_truthy end @@ -26,16 +25,15 @@ feature 'Group share with group lock' do context 'when disabling the parent group share with group lock (which was already enabled)' do background do visit edit_group_path(root_group) - check 'group_share_with_group_lock' - click_on 'Save group' + + enable_group_lock end context 'and the subgroup share with group lock is enabled' do scenario 'the subgroup share with group lock does not change' do visit edit_group_path(root_group) - uncheck 'group_share_with_group_lock' - click_on 'Save group' + disable_group_lock expect(subgroup.reload.share_with_group_lock?).to be_truthy end @@ -44,19 +42,32 @@ feature 'Group share with group lock' do context 'but the subgroup share with group lock is disabled' do background do visit edit_group_path(subgroup) - uncheck 'group_share_with_group_lock' - click_on 'Save group' + + disable_group_lock end scenario 'the subgroup share with group lock does not change' do visit edit_group_path(root_group) - uncheck 'group_share_with_group_lock' - click_on 'Save group' + disable_group_lock expect(subgroup.reload.share_with_group_lock?).to be_falsey end end end end + + def enable_group_lock + page.within('.gs-permissions') do + check 'group_share_with_group_lock' + click_on 'Save group' + end + end + + def disable_group_lock + page.within('.gs-permissions') do + uncheck 'group_share_with_group_lock' + click_on 'Save group' + end + end end diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 185770c312f..236768b5d7f 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -141,7 +141,7 @@ feature 'Group' do end it 'saves new settings' do - page.within('.as-general') do + page.within('.gs-general') do fill_in 'group_name', with: new_name click_button 'Save group' end diff --git a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb index e8884bc1a00..c8db82a562f 100644 --- a/spec/features/uploads/user_uploads_avatar_to_group_spec.rb +++ b/spec/features/uploads/user_uploads_avatar_to_group_spec.rb @@ -14,7 +14,9 @@ feature 'User uploads avatar to group' do visible: false ) - click_button 'Save group' + page.within('.gs-general') do + click_button 'Save group' + end visit group_path(group) |