Commit a67ff8e8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Move "remove group member" spec from spinach to rspec

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent c56f7876
......@@ -4,18 +4,6 @@ Feature: Group Members
And "John Doe" is owner of group "Owned"
And "John Doe" is guest of group "Guest"
# Remove others
Scenario: Owner should be able to remove other users from group
Given "Mary Jane" is owner of group "Owned"
When I visit group "Owned" members page
Then I should see user "John Doe" in team list
Then I should see user "Mary Jane" in team list
When I click on the "Remove User From Group" button for "Mary Jane"
When I visit group "Owned" members page
Then I should see user "John Doe" in team list
Then I should not see user "Mary Jane" in team list
Scenario: Guest should not be able to remove other users from group
Given "Mary Jane" is guest of group "Guest"
When I visit group "Guest" members page
......
......@@ -32,60 +32,6 @@ feature 'Groups > Members > List members', feature: true do
expect(second_row).to be_blank
end
scenario 'update user to owner level', :js do
group.add_owner(user1)
group.add_developer(user2)
visit group_group_members_path(group)
page.within(second_row) do
click_button('Developer')
click_link('Owner')
expect(page).to have_button('Owner')
end
end
scenario 'add user to group', :js do
group.add_owner(user1)
visit group_group_members_path(group)
add_user(user2.id, 'Reporter')
page.within(second_row) do
expect(page).to have_content(user2.name)
expect(page).to have_button('Reporter')
end
end
scenario 'add yourself to group when already an owner', :js do
group.add_owner(user1)
visit group_group_members_path(group)
add_user(user1.id, 'Reporter')
page.within(first_row) do
expect(page).to have_content(user1.name)
expect(page).to have_content('Owner')
end
end
scenario 'invite user to group', :js do
group.add_owner(user1)
visit group_group_members_path(group)
add_user('test@example.com', 'Reporter')
page.within(second_row) do
expect(page).to have_content('test@example.com')
expect(page).to have_content('Invited')
expect(page).to have_button('Reporter')
end
end
def first_row
page.all('ul.content-list > li')[0]
end
......@@ -93,13 +39,4 @@ feature 'Groups > Members > List members', feature: true do
def second_row
page.all('ul.content-list > li')[1]
end
def add_user(id, role)
page.within ".users-group-form" do
select2(id, from: "#user_ids", multiple: true)
select(role, from: "access_level")
end
click_button "Add to group"
end
end
require 'spec_helper'
feature 'Groups > Members > Manage members', feature: true do
include Select2Helper
let(:user1) { create(:user, name: 'John Doe') }
let(:user2) { create(:user, name: 'Mary Jane') }
let(:group) { create(:group) }
background do
gitlab_sign_in(user1)
end
scenario 'update user to owner level', :js do
group.add_owner(user1)
group.add_developer(user2)
visit group_group_members_path(group)
page.within(second_row) do
click_button('Developer')
click_link('Owner')
expect(page).to have_button('Owner')
end
end
scenario 'add user to group', :js do
group.add_owner(user1)
visit group_group_members_path(group)
add_user(user2.id, 'Reporter')
page.within(second_row) do
expect(page).to have_content(user2.name)
expect(page).to have_button('Reporter')
end
end
scenario 'remove user from group', :js do
group.add_owner(user1)
group.add_developer(user2)
visit group_group_members_path(group)
find(:css, '.project-members-page li', text: user2.name).find(:css, 'a.btn-remove').click
expect(page).not_to have_content(user2.name)
expect(group.users).not_to include(user2)
end
scenario 'add yourself to group when already an owner', :js do
group.add_owner(user1)
visit group_group_members_path(group)
add_user(user1.id, 'Reporter')
page.within(first_row) do
expect(page).to have_content(user1.name)
expect(page).to have_content('Owner')
end
end
scenario 'invite user to group', :js do
group.add_owner(user1)
visit group_group_members_path(group)
add_user('test@example.com', 'Reporter')
page.within(second_row) do
expect(page).to have_content('test@example.com')
expect(page).to have_content('Invited')
expect(page).to have_button('Reporter')
end
end
def first_row
page.all('ul.content-list > li')[0]
end
def second_row
page.all('ul.content-list > li')[1]
end
def add_user(id, role)
page.within ".users-group-form" do
select2(id, from: "#user_ids", multiple: true)
select(role, from: "access_level")
end
click_button "Add to group"
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment