summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-10-22 21:42:06 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-10-22 21:42:06 +0300
commit42abdf69d59ecf28688af5994ff2e324c50a6d33 (patch)
tree3f7f9a2f43547af2de67641eee87d98304e35129 /features
parent83dc5f936290cd928362c56959a40b906a2acd15 (diff)
downloadgitlab-ce-42abdf69d59ecf28688af5994ff2e324c50a6d33.tar.gz
More group tests with spinach
Diffstat (limited to 'features')
-rw-r--r--features/admin/groups.feature10
-rw-r--r--features/group/group.feature10
-rw-r--r--features/steps/admin/admin_groups.rb24
-rw-r--r--features/steps/group/group.rb38
-rw-r--r--features/steps/shared/paths.rb20
5 files changed, 98 insertions, 4 deletions
diff --git a/features/admin/groups.feature b/features/admin/groups.feature
new file mode 100644
index 00000000000..e5eab8e6ecb
--- /dev/null
+++ b/features/admin/groups.feature
@@ -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
diff --git a/features/group/group.feature b/features/group/group.feature
index dbddb92ccce..07308112270 100644
--- a/features/group/group.feature
+++ b/features/group/group.feature
@@ -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
diff --git a/features/steps/admin/admin_groups.rb b/features/steps/admin/admin_groups.rb
new file mode 100644
index 00000000000..e1759013ce7
--- /dev/null
+++ b/features/steps/admin/admin_groups.rb
@@ -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
+
diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb
index 798c62c3a11..51581a1ec7b 100644
--- a/features/steps/group/group.rb
+++ b/features/steps/group/group.rb
@@ -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
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index eda5ab94116..b4e4b810c20 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -6,6 +6,22 @@ module SharedPaths
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
# ----------------------------------------