gitlab-org--gitlab-foss/features/steps/group/group.rb

113 lines
2.8 KiB
Ruby
Raw Normal View History

2012-10-03 06:42:17 -04:00
class Groups < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include Select2Helper
2012-10-03 06:42:17 -04:00
Then 'I should see projects list' do
2013-01-02 12:56:22 -05:00
current_user.authorized_projects.each do |project|
2012-10-03 06:42:17 -04:00
page.should have_link project.name
end
end
And 'I have group with projects' do
2012-12-26 11:31:47 -05:00
@group = create(:group, owner: current_user)
@project = create(:project, group: @group)
@event = create(:closed_issue_event, project: @project)
2012-10-03 06:42:17 -04:00
@project.team << [current_user, :master]
2012-10-03 06:42:17 -04:00
end
And 'I should see projects activity feed' do
page.should have_content 'closed issue'
end
2012-10-22 14:42:06 -04:00
Then 'I should see issues from this group 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
assigned_to_me(:merge_requests).each do |issue|
page.should have_content issue.title[0..80]
2012-10-22 14:42:06 -04:00
end
end
2012-12-25 17:52:49 -05:00
Given 'I have new user "John"' do
create(:user, name: "John")
end
2012-12-26 11:31:47 -05:00
And 'I select user "John" from list with role "Reporter"' do
2012-12-25 17:52:49 -05:00
user = User.find_by_name("John")
within "#new_team_member" do
select2(user.id, from: "#user_ids", multiple: true)
select "Reporter", from: "project_access"
2012-12-25 17:52:49 -05:00
end
click_button "Add"
end
Then 'I should see user "John" in team list' do
2012-12-26 11:31:47 -05:00
projects_with_access = find(".ui-box .well-list")
2012-12-25 17:52:49 -05:00
projects_with_access.should have_content("John")
end
2012-10-22 14:42:06 -04:00
Given 'project from group 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
create :merge_request,
project: project,
assignee: current_user,
author: current_user
end
2013-01-24 10:47:09 -05:00
When 'I click new group link' do
click_link "New Group"
end
And 'submit form with new group info' do
2013-02-28 09:55:35 -05:00
fill_in 'group_name', with: 'Samurai'
fill_in 'group_description', with: 'Tokugawa Shogunate'
2013-01-24 10:47:09 -05:00
click_button "Create group"
end
Then 'I should see newly created group' do
page.should have_content "Samurai"
page.should have_content "Tokugawa Shogunate"
2013-01-24 10:47:09 -05:00
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
fill_in 'group_name', with: 'new-name'
click_button "Save group"
end
Then 'I should see new group name' do
within ".navbar-gitlab" do
page.should have_content "group: new-name"
end
end
2012-10-03 06:42:17 -04:00
protected
def current_group
@group ||= Group.first
end
2012-10-22 14:42:06 -04:00
def project
2013-01-02 13:45:11 -05:00
current_group.projects.first
2012-10-22 14:42:06 -04:00
end
def assigned_to_me key
project.send(key).where(assignee_id: current_user.id)
end
2012-10-03 06:42:17 -04:00
end