summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-09 08:14:05 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-09 08:14:05 +0300
commit2f6603e58174e5aff35fbc0ce6a9616dc77b077a (patch)
tree86a4383571f73ad2666cc879ae67c1fb5059cf70
parentab344f31b6a9b9456ffed1d30fb77bc6bd0a2381 (diff)
downloadgitlab-ce-2f6603e58174e5aff35fbc0ce6a9616dc77b077a.tar.gz
A bit of spinach tests
-rw-r--r--features/admin/logs.feature0
-rw-r--r--features/admin/projects.feature13
-rw-r--r--features/admin/users.feature0
-rw-r--r--features/project/project.feature19
-rw-r--r--features/steps/admin/admin_projects.rb24
-rw-r--r--features/steps/dashboard/dashboard.rb38
-rw-r--r--features/steps/project/project.rb13
-rw-r--r--features/steps/shared/admin.rb8
-rw-r--r--features/steps/shared/paths.rb5
-rw-r--r--features/steps/shared/project.rb38
-rw-r--r--spec/requests/projects_spec.rb53
11 files changed, 116 insertions, 95 deletions
diff --git a/features/admin/logs.feature b/features/admin/logs.feature
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/features/admin/logs.feature
diff --git a/features/admin/projects.feature b/features/admin/projects.feature
new file mode 100644
index 00000000000..4a4ee1c11e0
--- /dev/null
+++ b/features/admin/projects.feature
@@ -0,0 +1,13 @@
+Feature: Admin Projects
+ Background:
+ Given I sign in as an admin
+ And there are projects in system
+
+ Scenario: Projects list
+ When I visit admin projects page
+ Then I should see all projects
+
+ Scenario: Projects show
+ When I visit admin projects page
+ And I click on first project
+ Then I should see project details
diff --git a/features/admin/users.feature b/features/admin/users.feature
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/features/admin/users.feature
diff --git a/features/project/project.feature b/features/project/project.feature
index 1c9f201df50..ad3d06bb41f 100644
--- a/features/project/project.feature
+++ b/features/project/project.feature
@@ -1,14 +1,23 @@
Feature: Projects
Background:
- Given I signin as a user
+ Given I sign in as a user
And I own project "Shop"
+ And project "Shop" has push event
And I visit project "Shop" page
- # @wip
- # Scenario: I should see project activity
+ Scenario: I should see project activity
+ When I visit project "Shop" page
+ Then I should see project "Shop" activity feed
- # @wip
- # Scenario: I edit project
+ Scenario: I visit edit project
+ When I visit edit project "Shop" page
+ Then I should see project settings
+
+ Scenario: I edit project
+ When I visit edit project "Shop" page
+ And change project settings
+ And I save project
+ Then I should see project with new settings
# @wip
# Scenario: I visit attachments
diff --git a/features/steps/admin/admin_projects.rb b/features/steps/admin/admin_projects.rb
new file mode 100644
index 00000000000..dd6b4e9810b
--- /dev/null
+++ b/features/steps/admin/admin_projects.rb
@@ -0,0 +1,24 @@
+class AdminProjects < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedAdmin
+
+ And 'I should see all projects' do
+ Project.all.each do |p|
+ page.should have_content p.name_with_namespace
+ end
+ end
+
+ And 'I click on first project' do
+ click_link Project.first.name_with_namespace
+ end
+
+ Then 'I should see project details' do
+ project = Project.first
+ current_path.should == admin_project_path(project)
+
+ page.should have_content(project.name_with_namespace)
+ page.should have_content(project.creator.name)
+ page.should have_content('Add new team member')
+ end
+end
diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb
index 73e22673749..4bcefba76de 100644
--- a/features/steps/dashboard/dashboard.rb
+++ b/features/steps/dashboard/dashboard.rb
@@ -1,6 +1,7 @@
class Dashboard < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
+ include SharedProject
Then 'I should see "New Project" link' do
page.should have_link "New Project"
@@ -10,11 +11,6 @@ class Dashboard < Spinach::FeatureSteps
page.should have_link "Shop"
end
- Then 'I should see project "Shop" activity feed' do
- project = Project.find_by_name("Shop")
- page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}"
- end
-
Then 'I should see last push widget' do
page.should have_content "You pushed to new_design"
page.should have_link "Create Merge Request"
@@ -59,11 +55,6 @@ class Dashboard < Spinach::FeatureSteps
page.should have_content "John Doe left project at Shop"
end
- And 'I own project "Shop"' do
- @project = create :project, name: 'Shop'
- @project.team << [@user, :master]
- end
-
And 'I have group with projects' do
@group = create(:group)
@project = create(:project, group: @group)
@@ -72,32 +63,6 @@ class Dashboard < Spinach::FeatureSteps
@project.team << [current_user, :master]
end
- And 'project "Shop" has push event' do
- @project = Project.find_by_name("Shop")
-
- data = {
- before: "0000000000000000000000000000000000000000",
- after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
- ref: "refs/heads/new_design",
- user_id: @user.id,
- user_name: @user.name,
- repository: {
- name: @project.name,
- url: "localhost/rubinius",
- description: "",
- homepage: "localhost/rubinius",
- private: true
- }
- }
-
- @event = Event.create(
- project: @project,
- action: Event::Pushed,
- data: data,
- author_id: @user.id
- )
- end
-
Then 'I should see groups list' do
Group.all.each do |group|
page.should have_link group.name
@@ -112,5 +77,4 @@ class Dashboard < Spinach::FeatureSteps
Then 'I should see 1 project at group list' do
page.find('span.last_activity/span').should have_content('1')
end
-
end
diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb
index f33f12eb0a8..7a85f57a218 100644
--- a/features/steps/project/project.rb
+++ b/features/steps/project/project.rb
@@ -2,4 +2,17 @@ class Projects < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
+
+ And 'change project settings' do
+ fill_in 'project_name', with: 'NewName'
+ uncheck 'project_issues_enabled'
+ end
+
+ And 'I save project' do
+ click_button 'Save'
+ end
+
+ Then 'I should see project with new settings' do
+ find_field('project_name').value.should == 'NewName'
+ end
end
diff --git a/features/steps/shared/admin.rb b/features/steps/shared/admin.rb
new file mode 100644
index 00000000000..bd1e5cec735
--- /dev/null
+++ b/features/steps/shared/admin.rb
@@ -0,0 +1,8 @@
+module SharedAdmin
+ include Spinach::DSL
+
+ And 'there are projects in system' do
+ 2.times { create(:project) }
+ end
+end
+
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 22d1f335063..1f5dfd243a1 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -165,6 +165,11 @@ module SharedPaths
visit project_path(project)
end
+ When 'I visit edit project "Shop" page' do
+ project = Project.find_by_name("Shop")
+ visit edit_project_path(project)
+ end
+
Given 'I visit project branches page' do
visit branches_project_repository_path(@project)
end
diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb
index 12dae15edf9..3150be5ef18 100644
--- a/features/steps/shared/project.rb
+++ b/features/steps/shared/project.rb
@@ -13,6 +13,44 @@ module SharedProject
@project.team << [@user, :master]
end
+ And 'project "Shop" has push event' do
+ @project = Project.find_by_name("Shop")
+
+ data = {
+ before: "0000000000000000000000000000000000000000",
+ after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
+ ref: "refs/heads/new_design",
+ user_id: @user.id,
+ user_name: @user.name,
+ repository: {
+ name: @project.name,
+ url: "localhost/rubinius",
+ description: "",
+ homepage: "localhost/rubinius",
+ private: true
+ }
+ }
+
+ @event = Event.create(
+ project: @project,
+ action: Event::Pushed,
+ data: data,
+ author_id: @user.id
+ )
+ end
+
+ Then 'I should see project "Shop" activity feed' do
+ project = Project.find_by_name("Shop")
+ page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}"
+ end
+
+ Then 'I should see project settings' do
+ current_path.should == edit_project_path(@project)
+ page.should have_content("Project name is")
+ page.should have_content("Advanced settings:")
+ page.should have_content("Features:")
+ end
+
def current_project
@project ||= Project.first
end
diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb
index 8f613b458c0..7bc48260935 100644
--- a/spec/requests/projects_spec.rb
+++ b/spec/requests/projects_spec.rb
@@ -3,59 +3,6 @@ require 'spec_helper'
describe "Projects" do
before { login_as :user }
- describe "GET /projects/show" do
- before do
- @project = create(:project, namespace: @user.namespace)
- @project.team << [@user, :reporter]
-
- visit project_path(@project)
- end
-
- it "should be correct path" do
- current_path.should == project_path(@project)
- end
- end
-
- describe "GET /projects/:id/edit" do
- before do
- @project = create(:project)
- @project.team << [@user, :master]
-
- visit edit_project_path(@project)
- end
-
- it "should be correct path" do
- current_path.should == edit_project_path(@project)
- end
-
- it "should have labels for new project" do
- page.should have_content("Project name is")
- page.should have_content("Advanced settings:")
- page.should have_content("Features:")
- end
- end
-
- describe "PUT /projects/:id" do
- before do
- @project = create(:project, namespace: @user.namespace)
- @project.team << [@user, :master]
-
- visit edit_project_path(@project)
-
- fill_in 'project_name', with: 'Awesome'
- click_button "Save"
- @project = @project.reload
- end
-
- it "should be correct path" do
- current_path.should == edit_project_path(@project)
- end
-
- it "should show project" do
- page.should have_content("Awesome")
- end
- end
-
describe "DELETE /projects/:id" do
before do
@project = create(:project, namespace: @user.namespace)