More group tests with spinach
This commit is contained in:
parent
83dc5f9362
commit
42abdf69d5
5 changed files with 98 additions and 4 deletions
10
features/admin/groups.feature
Normal file
10
features/admin/groups.feature
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
Feature: Admin Groups
|
||||||
|
Background:
|
||||||
|
Given I sign in as an admin
|
||||||
|
And I visit admin groups page
|
||||||
|
|
||||||
|
Scenario: Create a group
|
||||||
|
When I click new group link
|
||||||
|
And submit form with new group info
|
||||||
|
Then I should be redirected to group page
|
||||||
|
And I should see newly created group
|
|
@ -7,3 +7,13 @@ Feature: Groups
|
||||||
When I visit group page
|
When I visit group page
|
||||||
Then I should see projects list
|
Then I should see projects list
|
||||||
And I should see projects activity feed
|
And I should see projects activity feed
|
||||||
|
|
||||||
|
Scenario: I should see group issues list
|
||||||
|
Given project from group has issues assigned to me
|
||||||
|
When I visit group issues page
|
||||||
|
Then I should see issues from this group assigned to me
|
||||||
|
|
||||||
|
Scenario: I should see group merge requests list
|
||||||
|
Given project from group has merge requests assigned to me
|
||||||
|
When I visit group merge requests page
|
||||||
|
Then I should see merge requests from this group assigned to me
|
||||||
|
|
24
features/steps/admin/admin_groups.rb
Normal file
24
features/steps/admin/admin_groups.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
class AdminGroups < Spinach::FeatureSteps
|
||||||
|
include SharedAuthentication
|
||||||
|
include SharedPaths
|
||||||
|
include SharedActiveTab
|
||||||
|
|
||||||
|
When 'I click new group link' do
|
||||||
|
click_link "New Group"
|
||||||
|
end
|
||||||
|
|
||||||
|
And 'submit form with new group info' do
|
||||||
|
fill_in 'group_name', :with => 'gitlab'
|
||||||
|
fill_in 'group_code', :with => 'gitlab'
|
||||||
|
click_button "Save group"
|
||||||
|
end
|
||||||
|
|
||||||
|
Then 'I should see newly created group' do
|
||||||
|
page.should have_content "Group: gitlab"
|
||||||
|
end
|
||||||
|
|
||||||
|
Then 'I should be redirected to group page' do
|
||||||
|
current_path.should == admin_group_path(Group.last)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -2,10 +2,6 @@ class Groups < Spinach::FeatureSteps
|
||||||
include SharedAuthentication
|
include SharedAuthentication
|
||||||
include SharedPaths
|
include SharedPaths
|
||||||
|
|
||||||
When 'I visit group page' do
|
|
||||||
visit group_path(current_group)
|
|
||||||
end
|
|
||||||
|
|
||||||
Then 'I should see projects list' do
|
Then 'I should see projects list' do
|
||||||
current_user.projects.each do |project|
|
current_user.projects.each do |project|
|
||||||
page.should have_link project.name
|
page.should have_link project.name
|
||||||
|
@ -24,9 +20,43 @@ class Groups < Spinach::FeatureSteps
|
||||||
page.should have_content 'closed issue'
|
page.should have_content 'closed issue'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def current_group
|
def current_group
|
||||||
@group ||= Group.first
|
@group ||= Group.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def project
|
||||||
|
current_group.projects.first
|
||||||
|
end
|
||||||
|
|
||||||
|
def assigned_to_me key
|
||||||
|
project.send(key).where(assignee_id: current_user.id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,22 @@ module SharedPaths
|
||||||
visit new_project_path
|
visit new_project_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
# Group
|
||||||
|
# ----------------------------------------
|
||||||
|
|
||||||
|
When 'I visit group page' do
|
||||||
|
visit group_path(current_group)
|
||||||
|
end
|
||||||
|
|
||||||
|
When 'I visit group issues page' do
|
||||||
|
visit issues_group_path(current_group)
|
||||||
|
end
|
||||||
|
|
||||||
|
When 'I visit group merge requests page' do
|
||||||
|
visit merge_requests_group_path(current_group)
|
||||||
|
end
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Dashboard
|
# Dashboard
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
|
@ -85,6 +101,10 @@ module SharedPaths
|
||||||
visit admin_resque_path
|
visit admin_resque_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
And 'I visit admin groups page' do
|
||||||
|
visit admin_groups_path
|
||||||
|
end
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Generic Project
|
# Generic Project
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue