diff options
Diffstat (limited to 'spec/features/admin/admin_groups_spec.rb')
-rw-r--r-- | spec/features/admin/admin_groups_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index bbdf2f7f4a9..e7634f4e020 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -35,6 +35,7 @@ RSpec.describe 'Admin Groups' do expect(page).to have_field('group_path') expect(page).to have_field('group_visibility_level_0') expect(page).to have_field('description') + expect(page).to have_field('group_admin_note_attributes_note') end end @@ -47,10 +48,12 @@ RSpec.describe 'Admin Groups' do path_component = 'gitlab' group_name = 'GitLab group name' group_description = 'Description of group for GitLab' + group_admin_note = 'A note about this group by an admin' fill_in 'group_path', with: path_component fill_in 'group_name', with: group_name fill_in 'group_description', with: group_description + fill_in 'group_admin_note_attributes_note', with: group_admin_note click_button "Create group" expect(current_path).to eq admin_group_path(Group.find_by(path: path_component)) @@ -61,6 +64,8 @@ RSpec.describe 'Admin Groups' do expect(li_texts).to match group_name expect(li_texts).to match path_component expect(li_texts).to match group_description + p_texts = content.all('p').collect(&:text).join('/n') + expect(p_texts).to match group_admin_note end it 'shows the visibility level radio populated with the default value' do @@ -116,6 +121,16 @@ RSpec.describe 'Admin Groups' do expect(page).to have_link(group.name, href: group_path(group)) end + + it 'has a note if one is available' do + group = create(:group, :private) + note_text = 'A group administrator note' + group.update!(admin_note_attributes: { note: note_text }) + + visit admin_group_path(group) + + expect(page).to have_text(note_text) + end end describe 'group edit' do @@ -145,6 +160,36 @@ RSpec.describe 'Admin Groups' do expect(name_field.value).to eq original_name end + + it 'adding an admin note to group without one' do + group = create(:group, :private) + expect(group.admin_note).to be_nil + + visit admin_group_edit_path(group) + admin_note_text = 'A note by an administrator' + + fill_in 'group_admin_note_attributes_note', with: admin_note_text + click_button 'Save changes' + + expect(page).to have_content(admin_note_text) + end + + it 'editing an existing group admin note' do + admin_note_text = 'A note by an administrator' + new_admin_note_text = 'A new note by an administrator' + group = create(:group, :private) + group.create_admin_note(note: admin_note_text) + + visit admin_group_edit_path(group) + + admin_note_field = find('#group_admin_note_attributes_note') + expect(admin_note_field.value).to eq(admin_note_text) + + fill_in 'group_admin_note_attributes_note', with: new_admin_note_text + click_button 'Save changes' + + expect(page).to have_content(new_admin_note_text) + end end describe 'add user into a group', :js do |