Commit 2f6603e58174e5aff35fbc0ce6a9616dc77b077a
1 parent
ab344f31
Exists in
master
and in
4 other branches
A bit of spinach tests
Showing
11 changed files
with
116 additions
and
95 deletions
Show diff stats
... | ... | @@ -0,0 +1,13 @@ |
1 | +Feature: Admin Projects | |
2 | + Background: | |
3 | + Given I sign in as an admin | |
4 | + And there are projects in system | |
5 | + | |
6 | + Scenario: Projects list | |
7 | + When I visit admin projects page | |
8 | + Then I should see all projects | |
9 | + | |
10 | + Scenario: Projects show | |
11 | + When I visit admin projects page | |
12 | + And I click on first project | |
13 | + Then I should see project details | ... | ... |
features/project/project.feature
1 | 1 | Feature: Projects |
2 | 2 | Background: |
3 | - Given I signin as a user | |
3 | + Given I sign in as a user | |
4 | 4 | And I own project "Shop" |
5 | + And project "Shop" has push event | |
5 | 6 | And I visit project "Shop" page |
6 | 7 | |
7 | - # @wip | |
8 | - # Scenario: I should see project activity | |
8 | + Scenario: I should see project activity | |
9 | + When I visit project "Shop" page | |
10 | + Then I should see project "Shop" activity feed | |
9 | 11 | |
10 | - # @wip | |
11 | - # Scenario: I edit project | |
12 | + Scenario: I visit edit project | |
13 | + When I visit edit project "Shop" page | |
14 | + Then I should see project settings | |
15 | + | |
16 | + Scenario: I edit project | |
17 | + When I visit edit project "Shop" page | |
18 | + And change project settings | |
19 | + And I save project | |
20 | + Then I should see project with new settings | |
12 | 21 | |
13 | 22 | # @wip |
14 | 23 | # Scenario: I visit attachments | ... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +class AdminProjects < Spinach::FeatureSteps | |
2 | + include SharedAuthentication | |
3 | + include SharedPaths | |
4 | + include SharedAdmin | |
5 | + | |
6 | + And 'I should see all projects' do | |
7 | + Project.all.each do |p| | |
8 | + page.should have_content p.name_with_namespace | |
9 | + end | |
10 | + end | |
11 | + | |
12 | + And 'I click on first project' do | |
13 | + click_link Project.first.name_with_namespace | |
14 | + end | |
15 | + | |
16 | + Then 'I should see project details' do | |
17 | + project = Project.first | |
18 | + current_path.should == admin_project_path(project) | |
19 | + | |
20 | + page.should have_content(project.name_with_namespace) | |
21 | + page.should have_content(project.creator.name) | |
22 | + page.should have_content('Add new team member') | |
23 | + end | |
24 | +end | ... | ... |
features/steps/dashboard/dashboard.rb
1 | 1 | class Dashboard < Spinach::FeatureSteps |
2 | 2 | include SharedAuthentication |
3 | 3 | include SharedPaths |
4 | + include SharedProject | |
4 | 5 | |
5 | 6 | Then 'I should see "New Project" link' do |
6 | 7 | page.should have_link "New Project" |
... | ... | @@ -10,11 +11,6 @@ class Dashboard < Spinach::FeatureSteps |
10 | 11 | page.should have_link "Shop" |
11 | 12 | end |
12 | 13 | |
13 | - Then 'I should see project "Shop" activity feed' do | |
14 | - project = Project.find_by_name("Shop") | |
15 | - page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" | |
16 | - end | |
17 | - | |
18 | 14 | Then 'I should see last push widget' do |
19 | 15 | page.should have_content "You pushed to new_design" |
20 | 16 | page.should have_link "Create Merge Request" |
... | ... | @@ -59,11 +55,6 @@ class Dashboard < Spinach::FeatureSteps |
59 | 55 | page.should have_content "John Doe left project at Shop" |
60 | 56 | end |
61 | 57 | |
62 | - And 'I own project "Shop"' do | |
63 | - @project = create :project, name: 'Shop' | |
64 | - @project.team << [@user, :master] | |
65 | - end | |
66 | - | |
67 | 58 | And 'I have group with projects' do |
68 | 59 | @group = create(:group) |
69 | 60 | @project = create(:project, group: @group) |
... | ... | @@ -72,32 +63,6 @@ class Dashboard < Spinach::FeatureSteps |
72 | 63 | @project.team << [current_user, :master] |
73 | 64 | end |
74 | 65 | |
75 | - And 'project "Shop" has push event' do | |
76 | - @project = Project.find_by_name("Shop") | |
77 | - | |
78 | - data = { | |
79 | - before: "0000000000000000000000000000000000000000", | |
80 | - after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", | |
81 | - ref: "refs/heads/new_design", | |
82 | - user_id: @user.id, | |
83 | - user_name: @user.name, | |
84 | - repository: { | |
85 | - name: @project.name, | |
86 | - url: "localhost/rubinius", | |
87 | - description: "", | |
88 | - homepage: "localhost/rubinius", | |
89 | - private: true | |
90 | - } | |
91 | - } | |
92 | - | |
93 | - @event = Event.create( | |
94 | - project: @project, | |
95 | - action: Event::Pushed, | |
96 | - data: data, | |
97 | - author_id: @user.id | |
98 | - ) | |
99 | - end | |
100 | - | |
101 | 66 | Then 'I should see groups list' do |
102 | 67 | Group.all.each do |group| |
103 | 68 | page.should have_link group.name |
... | ... | @@ -112,5 +77,4 @@ class Dashboard < Spinach::FeatureSteps |
112 | 77 | Then 'I should see 1 project at group list' do |
113 | 78 | page.find('span.last_activity/span').should have_content('1') |
114 | 79 | end |
115 | - | |
116 | 80 | end | ... | ... |
features/steps/project/project.rb
... | ... | @@ -2,4 +2,17 @@ class Projects < Spinach::FeatureSteps |
2 | 2 | include SharedAuthentication |
3 | 3 | include SharedProject |
4 | 4 | include SharedPaths |
5 | + | |
6 | + And 'change project settings' do | |
7 | + fill_in 'project_name', with: 'NewName' | |
8 | + uncheck 'project_issues_enabled' | |
9 | + end | |
10 | + | |
11 | + And 'I save project' do | |
12 | + click_button 'Save' | |
13 | + end | |
14 | + | |
15 | + Then 'I should see project with new settings' do | |
16 | + find_field('project_name').value.should == 'NewName' | |
17 | + end | |
5 | 18 | end | ... | ... |
features/steps/shared/paths.rb
... | ... | @@ -165,6 +165,11 @@ module SharedPaths |
165 | 165 | visit project_path(project) |
166 | 166 | end |
167 | 167 | |
168 | + When 'I visit edit project "Shop" page' do | |
169 | + project = Project.find_by_name("Shop") | |
170 | + visit edit_project_path(project) | |
171 | + end | |
172 | + | |
168 | 173 | Given 'I visit project branches page' do |
169 | 174 | visit branches_project_repository_path(@project) |
170 | 175 | end | ... | ... |
features/steps/shared/project.rb
... | ... | @@ -13,6 +13,44 @@ module SharedProject |
13 | 13 | @project.team << [@user, :master] |
14 | 14 | end |
15 | 15 | |
16 | + And 'project "Shop" has push event' do | |
17 | + @project = Project.find_by_name("Shop") | |
18 | + | |
19 | + data = { | |
20 | + before: "0000000000000000000000000000000000000000", | |
21 | + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", | |
22 | + ref: "refs/heads/new_design", | |
23 | + user_id: @user.id, | |
24 | + user_name: @user.name, | |
25 | + repository: { | |
26 | + name: @project.name, | |
27 | + url: "localhost/rubinius", | |
28 | + description: "", | |
29 | + homepage: "localhost/rubinius", | |
30 | + private: true | |
31 | + } | |
32 | + } | |
33 | + | |
34 | + @event = Event.create( | |
35 | + project: @project, | |
36 | + action: Event::Pushed, | |
37 | + data: data, | |
38 | + author_id: @user.id | |
39 | + ) | |
40 | + end | |
41 | + | |
42 | + Then 'I should see project "Shop" activity feed' do | |
43 | + project = Project.find_by_name("Shop") | |
44 | + page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}" | |
45 | + end | |
46 | + | |
47 | + Then 'I should see project settings' do | |
48 | + current_path.should == edit_project_path(@project) | |
49 | + page.should have_content("Project name is") | |
50 | + page.should have_content("Advanced settings:") | |
51 | + page.should have_content("Features:") | |
52 | + end | |
53 | + | |
16 | 54 | def current_project |
17 | 55 | @project ||= Project.first |
18 | 56 | end | ... | ... |
spec/requests/projects_spec.rb
... | ... | @@ -3,59 +3,6 @@ require 'spec_helper' |
3 | 3 | describe "Projects" do |
4 | 4 | before { login_as :user } |
5 | 5 | |
6 | - describe "GET /projects/show" do | |
7 | - before do | |
8 | - @project = create(:project, namespace: @user.namespace) | |
9 | - @project.team << [@user, :reporter] | |
10 | - | |
11 | - visit project_path(@project) | |
12 | - end | |
13 | - | |
14 | - it "should be correct path" do | |
15 | - current_path.should == project_path(@project) | |
16 | - end | |
17 | - end | |
18 | - | |
19 | - describe "GET /projects/:id/edit" do | |
20 | - before do | |
21 | - @project = create(:project) | |
22 | - @project.team << [@user, :master] | |
23 | - | |
24 | - visit edit_project_path(@project) | |
25 | - end | |
26 | - | |
27 | - it "should be correct path" do | |
28 | - current_path.should == edit_project_path(@project) | |
29 | - end | |
30 | - | |
31 | - it "should have labels for new project" do | |
32 | - page.should have_content("Project name is") | |
33 | - page.should have_content("Advanced settings:") | |
34 | - page.should have_content("Features:") | |
35 | - end | |
36 | - end | |
37 | - | |
38 | - describe "PUT /projects/:id" do | |
39 | - before do | |
40 | - @project = create(:project, namespace: @user.namespace) | |
41 | - @project.team << [@user, :master] | |
42 | - | |
43 | - visit edit_project_path(@project) | |
44 | - | |
45 | - fill_in 'project_name', with: 'Awesome' | |
46 | - click_button "Save" | |
47 | - @project = @project.reload | |
48 | - end | |
49 | - | |
50 | - it "should be correct path" do | |
51 | - current_path.should == edit_project_path(@project) | |
52 | - end | |
53 | - | |
54 | - it "should show project" do | |
55 | - page.should have_content("Awesome") | |
56 | - end | |
57 | - end | |
58 | - | |
59 | 6 | describe "DELETE /projects/:id" do |
60 | 7 | before do |
61 | 8 | @project = create(:project, namespace: @user.namespace) | ... | ... |