Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCiro Santillli <ciro.santilli@gmail.com>2014-02-07 20:59:55 +0400
committerCiro Santillli <ciro.santilli@gmail.com>2014-02-12 18:52:53 +0400
commit439a61783d0b61bbcc8f3c9e5b828b2270a679aa (patch)
treee6a02b733ad2dea5bda94ea5ac25d333e1419589 /features/steps/group
parentc86553cd836b7be3948ace41ef47f85776a48a97 (diff)
User can leave group from group page.
Diffstat (limited to 'features/steps/group')
-rw-r--r--features/steps/group/group.rb105
1 files changed, 64 insertions, 41 deletions
diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb
index 686f683314a..bd59b7a12f6 100644
--- a/features/steps/group/group.rb
+++ b/features/steps/group/group.rb
@@ -1,42 +1,34 @@
class Groups < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
+ include SharedGroup
include SharedUser
include Select2Helper
- Then 'I should see projects list' do
- current_user.authorized_projects.each do |project|
+ Then 'I should see group "Owned" projects list' do
+ Group.find_by(name: "Owned").projects.each do |project|
page.should have_link project.name
end
end
- And 'I have group with projects' do
- @group = create(:group)
- @group.add_owner(current_user)
- @project = create(:project, namespace: @group)
- @event = create(:closed_issue_event, project: @project)
-
- @project.team << [current_user, :master]
- end
-
And 'I should see projects activity feed' do
page.should have_content 'closed issue'
end
- Then 'I should see issues from this group assigned to me' do
+ Then 'I should see issues from group "Owned" assigned to me' do
assigned_to_me(:issues).each do |issue|
page.should have_content issue.title
end
end
- Then 'I should see merge requests from this group assigned to me' do
+ Then 'I should see merge requests from group "Owned" assigned to me' do
assigned_to_me(:merge_requests).each do |issue|
page.should have_content issue.title[0..80]
end
end
- And 'I select user "John Doe" from list with role "Reporter"' do
- user = User.find_by(name: "John Doe")
+ And 'I select user "Mary Jane" from list with role "Reporter"' do
+ user = User.find_by(name: "Mary Jane") || create(:user, name: "Mary Jane")
within ".users-group-form" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "group_access"
@@ -49,14 +41,29 @@ class Groups < Spinach::FeatureSteps
projects_with_access.should have_content("John Doe")
end
- Given 'project from group has issues assigned to me' do
+ Then 'I should not see user "John Doe" in team list' do
+ projects_with_access = find(".ui-box .well-list")
+ projects_with_access.should_not have_content("John Doe")
+ end
+
+ Then 'I should see user "Mary Jane" in team list' do
+ projects_with_access = find(".ui-box .well-list")
+ projects_with_access.should have_content("Mary Jane")
+ end
+
+ Then 'I should not see user "Mary Jane" in team list' do
+ projects_with_access = find(".ui-box .well-list")
+ projects_with_access.should_not have_content("Mary Jane")
+ end
+
+ Given 'project from group "Owned" has issues assigned to me' do
create :issue,
project: project,
assignee: current_user,
author: current_user
end
- Given 'project from group has merge requests assigned to me' do
+ Given 'project from group "Owned" has merge requests assigned to me' do
create :merge_request,
source_project: project,
target_project: project,
@@ -68,78 +75,94 @@ class Groups < Spinach::FeatureSteps
click_link "New group"
end
- And 'submit form with new group info' do
+ And 'submit form with new group "Samurai" info' do
fill_in 'group_name', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate'
click_button "Create group"
end
- Then 'I should see newly created group' do
+ Then 'I should be redirected to group "Samurai" page' do
+ current_path.should == group_path(Group.last)
+ end
+
+ Then 'I should see newly created group "Samurai"' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
page.should have_content "You will only see events from projects in this group"
end
- Then 'I should be redirected to group page' do
- current_path.should == group_path(Group.last)
- end
-
- And 'I change group name' do
+ And 'I change group "Owned" name to "new-name"' do
fill_in 'group_name', with: 'new-name'
click_button "Save group"
end
- Then 'I should see new group name' do
+ Then 'I should see new group "Owned" name' do
within ".navbar-gitlab" do
page.should have_content "group: new-name"
end
end
- step 'I change my group avatar' do
+ step 'I change group "Owned" avatar' do
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button "Save group"
- @group.reload
+ Group.find_by(name: "Owned").reload
end
- step 'I should see new group avatar' do
- @group.avatar.should be_instance_of AttachmentUploader
- @group.avatar.url.should == "/uploads/group/avatar/#{ @group.id }/gitlab_logo.png"
+ step 'I should see new group "Owned" avatar' do
+ Group.find_by(name: "Owned").avatar.should be_instance_of AttachmentUploader
+ Group.find_by(name: "Owned").avatar.url.should == "/uploads/group/avatar/#{ Group.find_by(name:"Owned").id }/gitlab_logo.png"
end
step 'I should see the "Remove avatar" button' do
page.should have_link("Remove avatar")
end
- step 'I have an group avatar' do
+ step 'I have group "Owned" avatar' do
attach_file(:group_avatar, File.join(Rails.root, 'public', 'gitlab_logo.png'))
click_button "Save group"
- @group.reload
+ Group.find_by(name: "Owned").reload
end
- step 'I remove my group avatar' do
+ step 'I remove group "Owned" avatar' do
click_link "Remove avatar"
- @group.reload
+ Group.find_by(name: "Owned").reload
end
- step 'I should not see my group avatar' do
- @group.avatar?.should be_false
+ step 'I should not see group "Owned" avatar' do
+ Group.find_by(name: "Owned").avatar?.should be_false
end
step 'I should not see the "Remove avatar" button' do
page.should_not have_link("Remove avatar")
end
- protected
+ step 'I click on the "Remove User From Group" button for "John Doe"' do
+ find(:css, 'li', text: "John Doe").find(:css, 'a.btn-remove').click
+ # poltergeist always confirms popups.
+ end
- def current_group
- @group ||= Group.first
+ step 'I click on the "Remove User From Group" button for "Mary Jane"' do
+ find(:css, 'li', text: "Mary Jane").find(:css, 'a.btn-remove').click
+ # poltergeist always confirms popups.
end
- def project
- current_group.projects.first
+ step 'I should not see the "Remove User From Group" button for "John Doe"' do
+ find(:css, 'li', text: "John Doe").should_not have_selector(:css, 'a.btn-remove')
+ # poltergeist always confirms popups.
end
+ step 'I should not see the "Remove User From Group" button for "Mary Jane"' do
+ find(:css, 'li', text: "Mary Jane").should_not have_selector(:css, 'a.btn-remove')
+ # poltergeist always confirms popups.
+ end
+
+ protected
+
def assigned_to_me key
project.send(key).where(assignee_id: current_user.id)
end
+
+ def project
+ Group.find_by(name: "Owned").projects.first
+ end
end