Commit 42abdf69 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

More group tests with spinach

parent 83dc5f93
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
Then I should see projects list
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
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 SharedPaths
When 'I visit group page' do
visit group_path(current_group)
end
Then 'I should see projects list' do
current_user.projects.each do |project|
page.should have_link project.name
......@@ -24,9 +20,43 @@ class Groups < Spinach::FeatureSteps
page.should have_content 'closed issue'
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
def current_group
@group ||= Group.first
end
def project
current_group.projects.first
end
def assigned_to_me key
project.send(key).where(assignee_id: current_user.id)
end
end
......@@ -5,6 +5,22 @@ module SharedPaths
visit new_project_path
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
# ----------------------------------------
......@@ -85,6 +101,10 @@ module SharedPaths
visit admin_resque_path
end
And 'I visit admin groups page' do
visit admin_groups_path
end
# ----------------------------------------
# Generic Project
# ----------------------------------------
......
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