Commit 79eb5ab396690c613ea6e13c3c941ba1fa80f217

Authored by Nihad Abbasov
1 parent ef4e9c24

refactor feature steps

Showing 51 changed files with 993 additions and 1099 deletions   Show diff stats
features/project/create_project.feature
... ... @@ -4,7 +4,7 @@ Feature: Create Project
4 4 Should be able to create a new one
5 5  
6 6 Scenario: User create a project
7   - Given I signin as a user
  7 + Given I sign in as a user
8 8 When I visit new project page
9 9 And fill project form with valid data
10 10 Then I should see project page
... ...
features/project/wall.feature
1   -@javascript
2 1 Feature: Project Wall
3 2 In order to use Project Wall
4   - A user
5   - Should be able to read & write messages
  3 + A user should be able to read and write messages
6 4  
7 5 Background:
8   - Given I signin as a user
  6 + Given I sign in as a user
9 7 And I own project "Shop"
10 8 And I visit project "Shop" wall page
11 9  
... ...
features/steps/create_project.rb
... ... @@ -1,27 +0,0 @@
1   -class CreateProject < Spinach::FeatureSteps
2   - Given 'I signin as a user' do
3   - login_as :user
4   - end
5   -
6   - When 'I visit new project page' do
7   - visit new_project_path
8   - end
9   -
10   - And 'fill project form with valid data' do
11   - fill_in 'project_name', :with => 'NewProject'
12   - fill_in 'project_code', :with => 'NPR'
13   - fill_in 'project_path', :with => 'newproject'
14   - click_button "Create project"
15   - end
16   -
17   - Then 'I should see project page' do
18   - current_path.should == project_path(Project.last)
19   - page.should have_content('NewProject')
20   - end
21   -
22   - And 'I should see empty project instuctions' do
23   - page.should have_content "git init"
24   - page.should have_content "git remote"
25   - page.should have_content Project.last.url_to_repo
26   - end
27   -end
features/steps/dashboard.rb
... ... @@ -1,97 +0,0 @@
1   -class Dashboard < Spinach::FeatureSteps
2   - Then 'I should see "New Project" link' do
3   - page.should have_link "New Project"
4   - end
5   -
6   - Then 'I should see "Shop" project link' do
7   - page.should have_link "Shop"
8   - end
9   -
10   - Then 'I should see project "Shop" activity feed' do
11   - project = Project.find_by_name("Shop")
12   - page.should have_content "#{@user.name} pushed new branch new_design at #{project.name}"
13   - end
14   -
15   - Then 'I should see last push widget' do
16   - page.should have_content "Your pushed to branch new_design"
17   - page.should have_link "Create Merge Request"
18   - end
19   -
20   - And 'I click "Create Merge Request" link' do
21   - click_link "Create Merge Request"
22   - end
23   -
24   - Then 'I see prefilled new Merge Request page' do
25   - current_path.should == new_project_merge_request_path(@project)
26   - find("#merge_request_source_branch").value.should == "new_design"
27   - find("#merge_request_target_branch").value.should == "master"
28   - find("#merge_request_title").value.should == "New Design"
29   - end
30   -
31   - Given 'user with name "John Doe" joined project "Shop"' do
32   - user = Factory.create(:user, {name: "John Doe"})
33   - project = Project.find_by_name "Shop"
34   - Event.create(
35   - project: project,
36   - author_id: user.id,
37   - action: Event::Joined
38   - )
39   - end
40   -
41   - When 'I visit dashboard page' do
42   - visit dashboard_path
43   - end
44   -
45   - Then 'I should see "John Doe joined project Shop" event' do
46   - page.should have_content "John Doe joined project Shop"
47   - end
48   -
49   - And 'user with name "John Doe" left project "Shop"' do
50   - user = User.find_by_name "John Doe"
51   - project = Project.find_by_name "Shop"
52   - Event.create(
53   - project: project,
54   - author_id: user.id,
55   - action: Event::Left
56   - )
57   - end
58   -
59   - Then 'I should see "John Doe left project Shop" event' do
60   - page.should have_content "John Doe left project Shop"
61   - end
62   -
63   - Given 'I sign in as a user' do
64   - login_as :user
65   - end
66   -
67   - And 'I own project "Shop"' do
68   - @project = Factory :project, :name => 'Shop'
69   - @project.add_access(@user, :admin)
70   - end
71   -
72   - And 'project "Shop" has push event' do
73   - @project = Project.find_by_name("Shop")
74   -
75   - data = {
76   - :before => "0000000000000000000000000000000000000000",
77   - :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
78   - :ref => "refs/heads/new_design",
79   - :user_id => @user.id,
80   - :user_name => @user.name,
81   - :repository => {
82   - :name => @project.name,
83   - :url => "localhost/rubinius",
84   - :description => "",
85   - :homepage => "localhost/rubinius",
86   - :private => true
87   - }
88   - }
89   -
90   - @event = Event.create(
91   - :project => @project,
92   - :action => Event::Pushed,
93   - :data => data,
94   - :author_id => @user.id
95   - )
96   - end
97   -end
features/steps/dashboard/dashboard.rb 0 → 100644
... ... @@ -0,0 +1,92 @@
  1 +class Dashboard < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedPaths
  4 +
  5 + Then 'I should see "New Project" link' do
  6 + page.should have_link "New Project"
  7 + end
  8 +
  9 + Then 'I should see "Shop" project link' do
  10 + page.should have_link "Shop"
  11 + end
  12 +
  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 + Then 'I should see last push widget' do
  19 + page.should have_content "Your pushed to branch new_design"
  20 + page.should have_link "Create Merge Request"
  21 + end
  22 +
  23 + And 'I click "Create Merge Request" link' do
  24 + click_link "Create Merge Request"
  25 + end
  26 +
  27 + Then 'I see prefilled new Merge Request page' do
  28 + current_path.should == new_project_merge_request_path(@project)
  29 + find("#merge_request_source_branch").value.should == "new_design"
  30 + find("#merge_request_target_branch").value.should == "master"
  31 + find("#merge_request_title").value.should == "New Design"
  32 + end
  33 +
  34 + Given 'user with name "John Doe" joined project "Shop"' do
  35 + user = Factory.create(:user, {name: "John Doe"})
  36 + project = Project.find_by_name "Shop"
  37 + Event.create(
  38 + project: project,
  39 + author_id: user.id,
  40 + action: Event::Joined
  41 + )
  42 + end
  43 +
  44 + Then 'I should see "John Doe joined project Shop" event' do
  45 + page.should have_content "John Doe joined project Shop"
  46 + end
  47 +
  48 + And 'user with name "John Doe" left project "Shop"' do
  49 + user = User.find_by_name "John Doe"
  50 + project = Project.find_by_name "Shop"
  51 + Event.create(
  52 + project: project,
  53 + author_id: user.id,
  54 + action: Event::Left
  55 + )
  56 + end
  57 +
  58 + Then 'I should see "John Doe left project Shop" event' do
  59 + page.should have_content "John Doe left project Shop"
  60 + end
  61 +
  62 + And 'I own project "Shop"' do
  63 + @project = Factory :project, :name => 'Shop'
  64 + @project.add_access(@user, :admin)
  65 + end
  66 +
  67 + And 'project "Shop" has push event' do
  68 + @project = Project.find_by_name("Shop")
  69 +
  70 + data = {
  71 + :before => "0000000000000000000000000000000000000000",
  72 + :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
  73 + :ref => "refs/heads/new_design",
  74 + :user_id => @user.id,
  75 + :user_name => @user.name,
  76 + :repository => {
  77 + :name => @project.name,
  78 + :url => "localhost/rubinius",
  79 + :description => "",
  80 + :homepage => "localhost/rubinius",
  81 + :private => true
  82 + }
  83 + }
  84 +
  85 + @event = Event.create(
  86 + :project => @project,
  87 + :action => Event::Pushed,
  88 + :data => data,
  89 + :author_id => @user.id
  90 + )
  91 + end
  92 +end
... ...
features/steps/dashboard/dashboard_issues.rb 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +class DashboardIssues < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedPaths
  4 +
  5 + Then 'I should see issues assigned to me' do
  6 + issues = @user.issues
  7 + issues.each do |issue|
  8 + page.should have_content(issue.title[0..10])
  9 + page.should have_content(issue.project.name)
  10 + end
  11 + end
  12 +
  13 + And 'I have assigned issues' do
  14 + project = Factory :project
  15 + project.add_access(@user, :read, :write)
  16 +
  17 + 2.times { Factory :issue, :author => @user, :assignee => @user, :project => project }
  18 + end
  19 +end
... ...
features/steps/dashboard/dashboard_merge_requests.rb 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +class DashboardMergeRequests < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedPaths
  4 +
  5 + Then 'I should see my merge requests' do
  6 + merge_requests = @user.merge_requests
  7 + merge_requests.each do |mr|
  8 + page.should have_content(mr.title[0..10])
  9 + page.should have_content(mr.project.name)
  10 + end
  11 + end
  12 +
  13 + And 'I have authored merge requests' do
  14 + project1 = Factory :project
  15 + project2 = Factory :project
  16 +
  17 + project1.add_access(@user, :read, :write)
  18 + project2.add_access(@user, :read, :write)
  19 +
  20 + merge_request1 = Factory :merge_request, :author => @user, :project => project1
  21 + merge_request2 = Factory :merge_request, :author => @user, :project => project2
  22 + end
  23 +end
... ...
features/steps/dashboard/dashboard_search.rb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +class DashboardSearch < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedPaths
  4 +
  5 + Given 'I search for "Sho"' do
  6 + fill_in "dashboard_search", :with => "Sho"
  7 + click_button "Search"
  8 + end
  9 +
  10 + Then 'I should see "Shop" project link' do
  11 + page.should have_link "Shop"
  12 + end
  13 +
  14 + And 'I own project "Shop"' do
  15 + @project = Factory :project, :name => "Shop"
  16 + @project.add_access(@user, :admin)
  17 + end
  18 +end
... ...
features/steps/dashboard_issues.rb
... ... @@ -1,32 +0,0 @@
1   -class DashboardIssues < Spinach::FeatureSteps
2   - Then 'I should see issues assigned to me' do
3   - issues = @user.issues
4   - issues.each do |issue|
5   - page.should have_content(issue.title[0..10])
6   - page.should have_content(issue.project.name)
7   - end
8   - end
9   -
10   - Given 'I sign in as a user' do
11   - login_as :user
12   - end
13   -
14   - And 'I have assigned issues' do
15   - project = Factory :project
16   - project.add_access(@user, :read, :write)
17   -
18   - issue1 = Factory :issue,
19   - :author => @user,
20   - :assignee => @user,
21   - :project => project
22   -
23   - issue2 = Factory :issue,
24   - :author => @user,
25   - :assignee => @user,
26   - :project => project
27   - end
28   -
29   - And 'I visit dashboard issues page' do
30   - visit dashboard_issues_path
31   - end
32   -end
features/steps/dashboard_merge_requests.rb
... ... @@ -1,33 +0,0 @@
1   -class DashboardMergeRequests < Spinach::FeatureSteps
2   - Then 'I should see my merge requests' do
3   - merge_requests = @user.merge_requests
4   - merge_requests.each do |mr|
5   - page.should have_content(mr.title[0..10])
6   - page.should have_content(mr.project.name)
7   - end
8   - end
9   -
10   - Given 'I sign in as a user' do
11   - login_as :user
12   - end
13   -
14   - And 'I have authored merge requests' do
15   - project1 = Factory :project
16   - project2 = Factory :project
17   -
18   - project1.add_access(@user, :read, :write)
19   - project2.add_access(@user, :read, :write)
20   -
21   - merge_request1 = Factory :merge_request,
22   - :author => @user,
23   - :project => project1
24   -
25   - merge_request2 = Factory :merge_request,
26   - :author => @user,
27   - :project => project2
28   - end
29   -
30   - And 'I visit dashboard merge requests page' do
31   - visit dashboard_merge_requests_path
32   - end
33   -end
features/steps/dashboard_search.rb
... ... @@ -1,23 +0,0 @@
1   -class DashboardSearch < Spinach::FeatureSteps
2   - Given 'I search for "Sho"' do
3   - fill_in "dashboard_search", :with => "Sho"
4   - click_button "Search"
5   - end
6   -
7   - Then 'I should see "Shop" project link' do
8   - page.should have_link "Shop"
9   - end
10   -
11   - Given 'I sign in as a user' do
12   - login_as :user
13   - end
14   -
15   - And 'I own project "Shop"' do
16   - @project = Factory :project, :name => "Shop"
17   - @project.add_access(@user, :admin)
18   - end
19   -
20   - And 'I visit dashboard search page' do
21   - visit search_path
22   - end
23   -end
features/steps/profile.rb
... ... @@ -1,57 +0,0 @@
1   -class Profile < Spinach::FeatureSteps
2   - Given 'I visit profile page' do
3   - visit profile_path
4   - end
5   -
6   - Then 'I should see my profile info' do
7   - page.should have_content "Profile"
8   - page.should have_content @user.name
9   - page.should have_content @user.email
10   - end
11   -
12   - Then 'I change my contact info' do
13   - fill_in "user_skype", :with => "testskype"
14   - fill_in "user_linkedin", :with => "testlinkedin"
15   - fill_in "user_twitter", :with => "testtwitter"
16   - click_button "Save"
17   - @user.reload
18   - end
19   -
20   - And 'I should see new contact info' do
21   - @user.skype.should == 'testskype'
22   - @user.linkedin.should == 'testlinkedin'
23   - @user.twitter.should == 'testtwitter'
24   - end
25   -
26   - Given 'I visit profile password page' do
27   - visit profile_password_path
28   - end
29   -
30   - Then 'I change my password' do
31   - fill_in "user_password", :with => "222333"
32   - fill_in "user_password_confirmation", :with => "222333"
33   - click_button "Save"
34   - end
35   -
36   - And 'I should be redirected to sign in page' do
37   - current_path.should == new_user_session_path
38   - end
39   -
40   - Given 'I visit profile token page' do
41   - visit profile_token_path
42   - end
43   -
44   - Then 'I reset my token' do
45   - @old_token = @user.private_token
46   - click_button "Reset"
47   - end
48   -
49   - And 'I should see new token' do
50   - find("#token").value.should_not == @old_token
51   - find("#token").value.should == @user.reload.private_token
52   - end
53   -
54   - Given 'I sign in as a user' do
55   - login_as :user
56   - end
57   -end
features/steps/profile/profile.rb 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +class Profile < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedPaths
  4 +
  5 + Then 'I should see my profile info' do
  6 + page.should have_content "Profile"
  7 + page.should have_content @user.name
  8 + page.should have_content @user.email
  9 + end
  10 +
  11 + Then 'I change my contact info' do
  12 + fill_in "user_skype", :with => "testskype"
  13 + fill_in "user_linkedin", :with => "testlinkedin"
  14 + fill_in "user_twitter", :with => "testtwitter"
  15 + click_button "Save"
  16 + @user.reload
  17 + end
  18 +
  19 + And 'I should see new contact info' do
  20 + @user.skype.should == 'testskype'
  21 + @user.linkedin.should == 'testlinkedin'
  22 + @user.twitter.should == 'testtwitter'
  23 + end
  24 +
  25 + Then 'I change my password' do
  26 + fill_in "user_password", :with => "222333"
  27 + fill_in "user_password_confirmation", :with => "222333"
  28 + click_button "Save"
  29 + end
  30 +
  31 + And 'I should be redirected to sign in page' do
  32 + current_path.should == new_user_session_path
  33 + end
  34 +
  35 + Then 'I reset my token' do
  36 + @old_token = @user.private_token
  37 + click_button "Reset"
  38 + end
  39 +
  40 + And 'I should see new token' do
  41 + find("#token").value.should_not == @old_token
  42 + find("#token").value.should == @user.reload.private_token
  43 + end
  44 +end
... ...
features/steps/profile/profile_ssh_keys.rb 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +class ProfileSshKeys < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 +
  4 + Then 'I should see my ssh keys' do
  5 + @user.keys.each do |key|
  6 + page.should have_content(key.title)
  7 + end
  8 + end
  9 +
  10 + Given 'I click link "Add new"' do
  11 + click_link "Add new"
  12 + end
  13 +
  14 + And 'I submit new ssh key "Laptop"' do
  15 + fill_in "key_title", :with => "Laptop"
  16 + fill_in "key_key", :with => "ssh-rsa publickey234="
  17 + click_button "Save"
  18 + end
  19 +
  20 + Then 'I should see new ssh key "Laptop"' do
  21 + key = Key.find_by_title("Laptop")
  22 + page.should have_content(key.title)
  23 + page.should have_content(key.key)
  24 + current_path.should == key_path(key)
  25 + end
  26 +
  27 + Given 'I click link "Work"' do
  28 + click_link "Work"
  29 + end
  30 +
  31 + And 'I click link "Remove"' do
  32 + click_link "Remove"
  33 + end
  34 +
  35 + Then 'I visit profile keys page' do
  36 + visit keys_path
  37 + end
  38 +
  39 + And 'I should not see "Work" ssh key' do
  40 + within "#keys-table" do
  41 + page.should_not have_content "Work"
  42 + end
  43 + end
  44 +
  45 + And 'I have ssh key "ssh-rsa Work"' do
  46 + Factory :key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work"
  47 + end
  48 +end
... ...
features/steps/profile_ssh_keys.rb
... ... @@ -1,50 +0,0 @@
1   -class ProfileSshKeys < Spinach::FeatureSteps
2   - Then 'I should see my ssh keys' do
3   - @user.keys.each do |key|
4   - page.should have_content(key.title)
5   - end
6   - end
7   -
8   - Given 'I click link "Add new"' do
9   - click_link "Add new"
10   - end
11   -
12   - And 'I submit new ssh key "Laptop"' do
13   - fill_in "key_title", :with => "Laptop"
14   - fill_in "key_key", :with => "ssh-rsa publickey234="
15   - click_button "Save"
16   - end
17   -
18   - Then 'I should see new ssh key "Laptop"' do
19   - key = Key.find_by_title("Laptop")
20   - page.should have_content(key.title)
21   - page.should have_content(key.key)
22   - current_path.should == key_path(key)
23   - end
24   -
25   - Given 'I click link "Work"' do
26   - click_link "Work"
27   - end
28   -
29   - And 'I click link "Remove"' do
30   - click_link "Remove"
31   - end
32   -
33   - Then 'I visit profile keys page' do
34   - visit keys_path
35   - end
36   -
37   - And 'I should not see "Work" ssh key' do
38   - within "#keys-table" do
39   - page.should_not have_content "Work"
40   - end
41   - end
42   -
43   - Given 'I sign in as a user' do
44   - login_as :user
45   - end
46   -
47   - And 'I have ssh key "ssh-rsa Work"' do
48   - Factory :key, :user => @user, :title => "ssh-rsa Work", :key => "jfKLJDFKSFJSHFJssh-rsa Work"
49   - end
50   -end
features/steps/project.rb
... ... @@ -1,15 +0,0 @@
1   -class Projects < Spinach::FeatureSteps
2   - Given 'I sign in as a user' do
3   - login_as :user
4   - end
5   -
6   - And 'I own project "Shop"' do
7   - @project = Factory :project, :name => "Shop"
8   - @project.add_access(@user, :admin)
9   - end
10   -
11   - And 'I visit project "Shop" page' do
12   - project = Project.find_by_name("Shop")
13   - visit project_path(project)
14   - end
15   -end
features/steps/project/create_project.rb 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +class CreateProject < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedPaths
  4 +
  5 + And 'fill project form with valid data' do
  6 + fill_in 'project_name', :with => 'NewProject'
  7 + fill_in 'project_code', :with => 'NPR'
  8 + fill_in 'project_path', :with => 'newproject'
  9 + click_button "Create project"
  10 + end
  11 +
  12 + Then 'I should see project page' do
  13 + current_path.should == project_path(Project.last)
  14 + page.should have_content "NewProject"
  15 + end
  16 +
  17 + And 'I should see empty project instuctions' do
  18 + page.should have_content "git init"
  19 + page.should have_content "git remote"
  20 + page.should have_content Project.last.url_to_repo
  21 + end
  22 +end
... ...
features/steps/project/project.rb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +class Projects < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +end
... ...
features/steps/project/project_browse_branches.rb 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +class ProjectBrowseBranches < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Then 'I should see "Shop" recent branches list' do
  7 + page.should have_content "Branches"
  8 + page.should have_content "master"
  9 + end
  10 +
  11 + Given 'I click link "All"' do
  12 + click_link "All"
  13 + end
  14 +
  15 + Then 'I should see "Shop" all branches list' do
  16 + page.should have_content "Branches"
  17 + page.should have_content "master"
  18 + end
  19 +
  20 + Given 'I click link "Protected"' do
  21 + click_link "Protected"
  22 + end
  23 +
  24 + Then 'I should see "Shop" protected branches list' do
  25 + within "table" do
  26 + page.should have_content "stable"
  27 + page.should_not have_content "master"
  28 + end
  29 + end
  30 +
  31 + And 'project "Shop" has protected branches' do
  32 + project = Project.find_by_name("Shop")
  33 + project.protected_branches.create(:name => "stable")
  34 + end
  35 +end
... ...
features/steps/project/project_browse_commits.rb 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +class ProjectBrowseCommits < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Then 'I see project commits' do
  7 + current_path.should == project_commits_path(@project)
  8 +
  9 + commit = @project.commit
  10 + page.should have_content(@project.name)
  11 + page.should have_content(commit.message)
  12 + page.should have_content(commit.id.to_s[0..5])
  13 + end
  14 +
  15 + Given 'I click atom feed link' do
  16 + click_link "Feed"
  17 + end
  18 +
  19 + Then 'I see commits atom feed' do
  20 + commit = CommitDecorator.decorate(@project.commit)
  21 + page.response_headers['Content-Type'].should have_content("application/atom+xml")
  22 + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
  23 + page.body.should have_selector("author email", :text => commit.author_email)
  24 + page.body.should have_selector("entry summary", :text => commit.description)
  25 + end
  26 +
  27 + Given 'I click on commit link' do
  28 + visit project_commit_path(@project, ValidCommit::ID)
  29 + end
  30 +
  31 + Then 'I see commit info' do
  32 + page.should have_content ValidCommit::MESSAGE
  33 + page.should have_content "Showing 1 changed file"
  34 + end
  35 +
  36 + And 'I fill compare fields with refs' do
  37 + fill_in "from", :with => "master"
  38 + fill_in "to", :with => "stable"
  39 + click_button "Compare"
  40 + end
  41 +
  42 + And 'I see compared refs' do
  43 + page.should have_content "Commits (27)"
  44 + page.should have_content "Compare View"
  45 + page.should have_content "Showing 73 changed files"
  46 + end
  47 +end
... ...
features/steps/project/project_browse_files.rb 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +class ProjectBrowseFiles < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Then 'I should see files from repository' do
  7 + page.should have_content "app"
  8 + page.should have_content "History"
  9 + page.should have_content "Gemfile"
  10 + end
  11 +
  12 + Then 'I should see files from repository for "8470d70"' do
  13 + current_path.should == tree_project_ref_path(@project, "8470d70")
  14 + page.should have_content "app"
  15 + page.should have_content "History"
  16 + page.should have_content "Gemfile"
  17 + end
  18 +
  19 + Given 'I click on "Gemfile" file in repo' do
  20 + click_link "Gemfile"
  21 + end
  22 +
  23 + Then 'I should see it content' do
  24 + page.should have_content "rubygems.org"
  25 + end
  26 +
  27 + And 'I click link "raw"' do
  28 + click_link "raw"
  29 + end
  30 +
  31 + Then 'I should see raw file content' do
  32 + page.source.should == ValidCommit::BLOB_FILE
  33 + end
  34 +end
... ...
features/steps/project/project_browse_git_repo.rb 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +class ProjectBrowseGitRepo < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Given 'I click on "Gemfile" file in repo' do
  7 + click_link "Gemfile"
  8 + end
  9 +
  10 + And 'I click blame button' do
  11 + click_link "blame"
  12 + end
  13 +
  14 + Then 'I should see git file blame' do
  15 + page.should have_content "rubygems.org"
  16 + page.should have_content "Dmitriy Zaporozhets"
  17 + page.should have_content "bc3735004cb Moving to rails 3.2"
  18 + end
  19 +end
... ...
features/steps/project/project_browse_tags.rb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +class ProjectBrowseTags < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Then 'I should see "Shop" all tags list' do
  7 + page.should have_content "Tags"
  8 + page.should have_content "v1.2.1"
  9 + end
  10 +end
... ...
features/steps/project/project_comment_commit.rb 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +class ProjectCommentCommit < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedNote
  5 + include SharedPaths
  6 +end
... ...
features/steps/project/project_issues.rb 0 → 100644
... ... @@ -0,0 +1,134 @@
  1 +class ProjectIssues < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedNote
  5 + include SharedPaths
  6 +
  7 + Given 'I should see "Release 0.4" in issues' do
  8 + page.should have_content "Release 0.4"
  9 + end
  10 +
  11 + And 'I should not see "Release 0.3" in issues' do
  12 + page.should_not have_content "Release 0.3"
  13 + end
  14 +
  15 + Given 'I click link "Closed"' do
  16 + click_link "Closed"
  17 + end
  18 +
  19 + Then 'I should see "Release 0.3" in issues' do
  20 + page.should have_content "Release 0.3"
  21 + end
  22 +
  23 + And 'I should not see "Release 0.4" in issues' do
  24 + page.should_not have_content "Release 0.4"
  25 + end
  26 +
  27 + Given 'I click link "All"' do
  28 + click_link "All"
  29 + end
  30 +
  31 + Given 'I click link "Release 0.4"' do
  32 + click_link "Release 0.4"
  33 + end
  34 +
  35 + Then 'I should see issue "Release 0.4"' do
  36 + page.should have_content "Release 0.4"
  37 + end
  38 +
  39 + Given 'I click link "New Issue"' do
  40 + click_link "New Issue"
  41 + end
  42 +
  43 + And 'I submit new issue "500 error on profile"' do
  44 + fill_in "issue_title", :with => "500 error on profile"
  45 + click_button "Submit new issue"
  46 + end
  47 +
  48 + Given 'I click link "500 error on profile"' do
  49 + click_link "500 error on profile"
  50 + end
  51 +
  52 + Then 'I should see issue "500 error on profile"' do
  53 + issue = Issue.find_by_title("500 error on profile")
  54 + page.should have_content issue.title
  55 + page.should have_content issue.author_name
  56 + page.should have_content issue.project.name
  57 + end
  58 +
  59 + Given 'I fill in issue search with "Release"' do
  60 + fill_in 'issue_search', with: "Release"
  61 + end
  62 +
  63 + Given 'I fill in issue search with "Bug"' do
  64 + fill_in 'issue_search', with: "Bug"
  65 + end
  66 +
  67 + And 'I fill in issue search with "0.3"' do
  68 + fill_in 'issue_search', with: "0.3"
  69 + end
  70 +
  71 + And 'I fill in issue search with "Something"' do
  72 + fill_in 'issue_search', with: "Something"
  73 + end
  74 +
  75 + And 'I fill in issue search with ""' do
  76 + page.execute_script("$('.issue_search').val('').keyup();");
  77 + fill_in 'issue_search', with: ""
  78 + end
  79 +
  80 + Given 'project "Shop" has milestone "v2.2"' do
  81 + project = Project.find_by_name("Shop")
  82 + milestone = Factory :milestone, :title => "v2.2", :project => project
  83 +
  84 + 3.times { Factory :issue, :project => project, :milestone => milestone }
  85 + end
  86 +
  87 + And 'project "Shop" has milestone "v3.0"' do
  88 + project = Project.find_by_name("Shop")
  89 + milestone = Factory :milestone, :title => "v3.0", :project => project
  90 +
  91 + 3.times { Factory :issue, :project => project, :milestone => milestone }
  92 + end
  93 +
  94 + When 'I select milestone "v3.0"' do
  95 + select "v3.0", from: "milestone_id"
  96 + end
  97 +
  98 + Then 'I should see selected milestone with title "v3.0"' do
  99 + issues_milestone_selector = "#issue_milestone_id_chzn/a"
  100 + wait_until { page.has_content?("Details") }
  101 + page.find(issues_milestone_selector).should have_content("v3.0")
  102 + end
  103 +
  104 + When 'I select first assignee from "Shop" project' do
  105 + project = Project.find_by_name "Shop"
  106 + first_assignee = project.users.first
  107 + select first_assignee.name, from: "assignee_id"
  108 + end
  109 +
  110 + Then 'I should see first assignee from "Shop" as selected assignee' do
  111 + issues_assignee_selector = "#issue_assignee_id_chzn/a"
  112 + wait_until { page.has_content?("Details") }
  113 + project = Project.find_by_name "Shop"
  114 + assignee_name = project.users.first.name
  115 + page.find(issues_assignee_selector).should have_content(assignee_name)
  116 + end
  117 +
  118 + And 'project "Shop" have "Release 0.4" open issue' do
  119 + project = Project.find_by_name("Shop")
  120 + Factory.create(:issue,
  121 + :title => "Release 0.4",
  122 + :project => project,
  123 + :author => project.users.first)
  124 + end
  125 +
  126 + And 'project "Shop" have "Release 0.3" closed issue' do
  127 + project = Project.find_by_name("Shop")
  128 + Factory.create(:issue,
  129 + :title => "Release 0.3",
  130 + :project => project,
  131 + :author => project.users.first,
  132 + :closed => true)
  133 + end
  134 +end
... ...
features/steps/project/project_labels.rb 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +class ProjectLabels < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Then 'I should see label "bug"' do
  7 + within ".labels-table" do
  8 + page.should have_content "bug"
  9 + end
  10 + end
  11 +
  12 + And 'I should see label "feature"' do
  13 + within ".labels-table" do
  14 + page.should have_content "feature"
  15 + end
  16 + end
  17 +
  18 + And 'project "Shop" have issues tags: "bug", "feature"' do
  19 + project = Project.find_by_name("Shop")
  20 + ['bug', 'feature'].each do |label|
  21 + Factory :issue, project: project, label_list: label
  22 + end
  23 + end
  24 +end
... ...
features/steps/project/project_merge_requests.rb 0 → 100644
... ... @@ -0,0 +1,80 @@
  1 +class ProjectMergeRequests < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedNote
  5 + include SharedPaths
  6 +
  7 + Then 'I should see "Bug NS-04" in merge requests' do
  8 + page.should have_content "Bug NS-04"
  9 + end
  10 +
  11 + And 'I should not see "Feature NS-03" in merge requests' do
  12 + page.should_not have_content "Feature NS-03"
  13 + end
  14 +
  15 + Given 'I click link "Closed"' do
  16 + click_link "Closed"
  17 + end
  18 +
  19 + Then 'I should see "Feature NS-03" in merge requests' do
  20 + page.should have_content "Feature NS-03"
  21 + end
  22 +
  23 + And 'I should not see "Bug NS-04" in merge requests' do
  24 + page.should_not have_content "Bug NS-04"
  25 + end
  26 +
  27 + Given 'I click link "All"' do
  28 + click_link "All"
  29 + end
  30 +
  31 + Given 'I click link "Bug NS-04"' do
  32 + click_link "Bug NS-04"
  33 + end
  34 +
  35 + Then 'I should see merge request "Bug NS-04"' do
  36 + page.should have_content "Bug NS-04"
  37 + end
  38 +
  39 + And 'I click link "Close"' do
  40 + click_link "Close"
  41 + end
  42 +
  43 + Then 'I should see closed merge request "Bug NS-04"' do
  44 + mr = MergeRequest.find_by_title("Bug NS-04")
  45 + mr.closed.should be_true
  46 + page.should have_content "Closed by"
  47 + end
  48 +
  49 + Given 'I click link "New Merge Request"' do
  50 + click_link "New Merge Request"
  51 + end
  52 +
  53 + And 'I submit new merge request "Wiki Feature"' do
  54 + fill_in "merge_request_title", :with => "Wiki Feature"
  55 + select "master", :from => "merge_request_source_branch"
  56 + select "stable", :from => "merge_request_target_branch"
  57 + click_button "Save"
  58 + end
  59 +
  60 + Then 'I should see merge request "Wiki Feature"' do
  61 + page.should have_content "Wiki Feature"
  62 + end
  63 +
  64 + And 'project "Shop" have "Bug NS-04" open merge request' do
  65 + project = Project.find_by_name("Shop")
  66 + Factory.create(:merge_request,
  67 + :title => "Bug NS-04",
  68 + :project => project,
  69 + :author => project.users.first)
  70 + end
  71 +
  72 + And 'project "Shop" have "Feature NS-03" closed merge request' do
  73 + project = Project.find_by_name("Shop")
  74 + Factory.create(:merge_request,
  75 + :title => "Feature NS-03",
  76 + :project => project,
  77 + :author => project.users.first,
  78 + :closed => true)
  79 + end
  80 +end
... ...
features/steps/project/project_milestones.rb 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +class ProjectMilestones < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Then 'I should see milestone "v2.2"' do
  7 + milestone = @project.milestones.find_by_title("v2.2")
  8 + page.should have_content(milestone.title[0..10])
  9 + page.should have_content(milestone.expires_at)
  10 + page.should have_content("Browse Issues")
  11 + end
  12 +
  13 + Given 'I click link "v2.2"' do
  14 + click_link "v2.2"
  15 + end
  16 +
  17 + Given 'I click link "New Milestone"' do
  18 + click_link "New Milestone"
  19 + end
  20 +
  21 + And 'I submit new milestone "v2.3"' do
  22 + fill_in "milestone_title", :with => "v2.3"
  23 + click_button "Create milestone"
  24 + end
  25 +
  26 + Then 'I should see milestone "v2.3"' do
  27 + milestone = @project.milestones.find_by_title("v2.3")
  28 + page.should have_content(milestone.title[0..10])
  29 + page.should have_content(milestone.expires_at)
  30 + page.should have_content("Browse Issues")
  31 + end
  32 +
  33 + And 'project "Shop" has milestone "v2.2"' do
  34 + project = Project.find_by_name("Shop")
  35 + milestone = Factory :milestone, :title => "v2.2", :project => project
  36 +
  37 + 3.times { Factory :issue, :project => project, :milestone => milestone }
  38 + end
  39 +end
... ...
features/steps/project/project_network_graph.rb 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +class ProjectNetworkGraph < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 +
  5 + Then 'page should have network graph' do
  6 + page.should have_content "Project Network Graph"
  7 + within ".graph" do
  8 + page.should have_content "master"
  9 + page.should have_content "scss_refactor..."
  10 + end
  11 + end
  12 +
  13 + And 'I visit project "Shop" network page' do
  14 + project = Project.find_by_name("Shop")
  15 +
  16 + # Stub out find_all to speed this up (10 commits vs. 650)
  17 + commits = Grit::Commit.find_all(project.repo, nil, {max_count: 10})
  18 + Grit::Commit.stub(:find_all).and_return(commits)
  19 +
  20 + visit graph_project_path(project)
  21 + end
  22 +end
... ...
features/steps/project/project_team_management.rb 0 → 100644
... ... @@ -0,0 +1,89 @@
  1 +class ProjectTeamManagement < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedPaths
  5 +
  6 + Then 'I should be able to see myself in team' do
  7 + page.should have_content(@user.name)
  8 + page.should have_content(@user.email)
  9 + end
  10 +
  11 + And 'I should see "Sam" in team list' do
  12 + user = User.find_by_name("Sam")
  13 + page.should have_content(user.name)
  14 + page.should have_content(user.email)
  15 + end
  16 +
  17 + Given 'I click link "New Team Member"' do
  18 + click_link "New Team Member"
  19 + end
  20 +
  21 + And 'I select "Mike" as "Reporter"' do
  22 + user = User.find_by_name("Mike")
  23 + within "#new_team_member" do
  24 + select user.name, :from => "user_ids"
  25 + select "Reporter", :from => "project_access"
  26 + end
  27 + click_button "Save"
  28 + end
  29 +
  30 + Then 'I should see "Mike" in team list as "Reporter"' do
  31 + user = User.find_by_name("Mike")
  32 + role_id = find(".user_#{user.id} #team_member_project_access").value
  33 + role_id.should == UsersProject.access_roles["Reporter"].to_s
  34 + end
  35 +
  36 + Given 'I should see "Sam" in team list as "Developer"' do
  37 + user = User.find_by_name("Sam")
  38 + role_id = find(".user_#{user.id} #team_member_project_access").value
  39 + role_id.should == UsersProject.access_roles["Developer"].to_s
  40 + end
  41 +
  42 + And 'I change "Sam" role to "Reporter"' do
  43 + user = User.find_by_name("Sam")
  44 + within ".user_#{user.id}" do
  45 + select "Reporter", :from => "team_member_project_access"
  46 + end
  47 + end
  48 +
  49 + And 'I should see "Sam" in team list as "Reporter"' do
  50 + user = User.find_by_name("Sam")
  51 + role_id = find(".user_#{user.id} #team_member_project_access").value
  52 + role_id.should == UsersProject.access_roles["Reporter"].to_s
  53 + end
  54 +
  55 + Given 'I click link "Sam"' do
  56 + click_link "Sam"
  57 + end
  58 +
  59 + Then 'I should see "Sam" team profile' do
  60 + user = User.find_by_name("Sam")
  61 + page.should have_content(user.name)
  62 + page.should have_content(user.email)
  63 + page.should have_content("To team list")
  64 + end
  65 +
  66 + And 'I click link "Remove from team"' do
  67 + click_link "Remove from team"
  68 + end
  69 +
  70 + And 'I should not see "Sam" in team list' do
  71 + user = User.find_by_name("Sam")
  72 + page.should_not have_content(user.name)
  73 + page.should_not have_content(user.email)
  74 + end
  75 +
  76 + And 'gitlab user "Mike"' do
  77 + Factory :user, :name => "Mike"
  78 + end
  79 +
  80 + And 'gitlab user "Sam"' do
  81 + Factory :user, :name => "Sam"
  82 + end
  83 +
  84 + And '"Sam" is "Shop" developer' do
  85 + user = User.find_by_name("Sam")
  86 + project = Project.find_by_name("Shop")
  87 + project.add_access(user, :write)
  88 + end
  89 +end
... ...
features/steps/project/project_wall.rb 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +class ProjectWall < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedNote
  5 + include SharedPaths
  6 +end
... ...
features/steps/project/project_wiki.rb 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +class ProjectWiki < Spinach::FeatureSteps
  2 + include SharedAuthentication
  3 + include SharedProject
  4 + include SharedNote
  5 + include SharedPaths
  6 +
  7 + Given 'I create Wiki page' do
  8 + fill_in "Title", :with => 'Test title'
  9 + fill_in "Content", :with => '[link test](test)'
  10 + click_on "Save"
  11 + end
  12 +
  13 + Then 'I should see newly created wiki page' do
  14 + page.should have_content "Test title"
  15 + page.should have_content "link test"
  16 +
  17 + click_link "link test"
  18 + page.should have_content "Editing page"
  19 + end
  20 +end
... ...
features/steps/project_browse_branches.rb
... ... @@ -1,44 +0,0 @@
1   -class ProjectBrowseBranches < Spinach::FeatureSteps
2   - Then 'I should see "Shop" recent branches list' do
3   - page.should have_content "Branches"
4   - page.should have_content "master"
5   - end
6   -
7   - Given 'I click link "All"' do
8   - click_link "All"
9   - end
10   -
11   - Then 'I should see "Shop" all branches list' do
12   - page.should have_content "Branches"
13   - page.should have_content "master"
14   - end
15   -
16   - Given 'I click link "Protected"' do
17   - click_link "Protected"
18   - end
19   -
20   - Then 'I should see "Shop" protected branches list' do
21   - within "table" do
22   - page.should have_content "stable"
23   - page.should_not have_content "master"
24   - end
25   - end
26   -
27   - Given 'I sign in as a user' do
28   - login_as :user
29   - end
30   -
31   - And 'I own project "Shop"' do
32   - @project = Factory :project, :name => "Shop"
33   - @project.add_access(@user, :admin)
34   - end
35   -
36   - And 'project "Shop" has protected branches' do
37   - project = Project.find_by_name("Shop")
38   - project.protected_branches.create(:name => "stable")
39   - end
40   -
41   - Given 'I visit project branches page' do
42   - visit branches_project_repository_path(@project)
43   - end
44   -end
features/steps/project_browse_commits.rb
... ... @@ -1,60 +0,0 @@
1   -class ProjectBrowseCommits < Spinach::FeatureSteps
2   - Then 'I see project commits' do
3   - current_path.should == project_commits_path(@project)
4   -
5   - commit = @project.commit
6   - page.should have_content(@project.name)
7   - page.should have_content(commit.message)
8   - page.should have_content(commit.id.to_s[0..5])
9   - end
10   -
11   - Given 'I click atom feed link' do
12   - click_link "Feed"
13   - end
14   -
15   - Then 'I see commits atom feed' do
16   - commit = CommitDecorator.decorate(@project.commit)
17   - page.response_headers['Content-Type'].should have_content("application/atom+xml")
18   - page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
19   - page.body.should have_selector("author email", :text => commit.author_email)
20   - page.body.should have_selector("entry summary", :text => commit.description)
21   - end
22   -
23   - Given 'I click on commit link' do
24   - visit project_commit_path(@project, ValidCommit::ID)
25   - end
26   -
27   - Then 'I see commit info' do
28   - page.should have_content ValidCommit::MESSAGE
29   - page.should have_content "Showing 1 changed file"
30   - end
31   -
32   - Given 'I visit compare refs page' do
33   - visit compare_project_commits_path(@project)
34   - end
35   -
36   - And 'I fill compare fields with refs' do
37   - fill_in "from", :with => "master"
38   - fill_in "to", :with => "stable"
39   - click_button "Compare"
40   - end
41   -
42   - And 'I see compared refs' do
43   - page.should have_content "Commits (27)"
44   - page.should have_content "Compare View"
45   - page.should have_content "Showing 73 changed files"
46   - end
47   -
48   - Given 'I sign in as a user' do
49   - login_as :user
50   - end
51   -
52   - And 'I own project "Shop"' do
53   - @project = Factory :project, :name => "Shop"
54   - @project.add_access(@user, :admin)
55   - end
56   -
57   - Given 'I visit project commits page' do
58   - visit project_commits_path(@project)
59   - end
60   -end
features/steps/project_browse_files.rb
... ... @@ -1,51 +0,0 @@
1   -class ProjectBrowseFiles < Spinach::FeatureSteps
2   - Then 'I should see files from repository' do
3   - page.should have_content "app"
4   - page.should have_content "History"
5   - page.should have_content "Gemfile"
6   - end
7   -
8   - Given 'I visit project source page for "8470d70"' do
9   - visit tree_project_ref_path(@project, "8470d70")
10   - end
11   -
12   - Then 'I should see files from repository for "8470d70"' do
13   - current_path.should == tree_project_ref_path(@project, "8470d70")
14   - page.should have_content "app"
15   - page.should have_content "History"
16   - page.should have_content "Gemfile"
17   - end
18   -
19   - Given 'I click on "Gemfile" file in repo' do
20   - click_link "Gemfile"
21   - end
22   -
23   - Then 'I should see it content' do
24   - page.should have_content "rubygems.org"
25   - end
26   -
27   - Given 'I visit blob file from repo' do
28   - visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
29   - end
30   -
31   - And 'I click link "raw"' do
32   - click_link "raw"
33   - end
34   -
35   - Then 'I should see raw file content' do
36   - page.source.should == ValidCommit::BLOB_FILE
37   - end
38   -
39   - Given 'I sign in as a user' do
40   - login_as :user
41   - end
42   -
43   - And 'I own project "Shop"' do
44   - @project = Factory :project, :name => "Shop"
45   - @project.add_access(@user, :admin)
46   - end
47   -
48   - Given 'I visit project source page' do
49   - visit tree_project_ref_path(@project, @project.root_ref)
50   - end
51   -end
features/steps/project_browse_git_repo.rb
... ... @@ -1,28 +0,0 @@
1   -class ProjectBrowseGitRepo < Spinach::FeatureSteps
2   - Given 'I click on "Gemfile" file in repo' do
3   - click_link "Gemfile"
4   - end
5   -
6   - And 'I click blame button' do
7   - click_link "blame"
8   - end
9   -
10   - Then 'I should see git file blame' do
11   - page.should have_content "rubygems.org"
12   - page.should have_content "Dmitriy Zaporozhets"
13   - page.should have_content "bc3735004cb Moving to rails 3.2"
14   - end
15   -
16   - Given 'I sign in as a user' do
17   - login_as :user
18   - end
19   -
20   - And 'I own project "Shop"' do
21   - @project = Factory :project, :name => "Shop"
22   - @project.add_access(@user, :admin)
23   - end
24   -
25   - Given 'I visit project source page' do
26   - visit tree_project_ref_path(@project, @project.root_ref)
27   - end
28   -end
features/steps/project_browse_tags.rb
... ... @@ -1,19 +0,0 @@
1   -class ProjectBrowseTags < Spinach::FeatureSteps
2   - Then 'I should see "Shop" all tags list' do
3   - page.should have_content "Tags"
4   - page.should have_content "v1.2.1"
5   - end
6   -
7   - Given 'I sign in as a user' do
8   - login_as :user
9   - end
10   -
11   - And 'I own project "Shop"' do
12   - @project = Factory :project, :name => "Shop"
13   - @project.add_access(@user, :admin)
14   - end
15   -
16   - Given 'I visit project tags page' do
17   - visit tags_project_repository_path(@project)
18   - end
19   -end
features/steps/project_comment_commit.rb
... ... @@ -1,23 +0,0 @@
1   -class ProjectCommentCommit < Spinach::FeatureSteps
2   - Given 'I leave a comment like "XML attached"' do
3   - fill_in "note_note", :with => "XML attached"
4   - click_button "Add Comment"
5   - end
6   -
7   - Then 'I should see comment "XML attached"' do
8   - page.should have_content "XML attached"
9   - end
10   -
11   - Given 'I sign in as a user' do
12   - login_as :user
13   - end
14   -
15   - And 'I own project "Shop"' do
16   - @project = Factory :project, :name => "Shop"
17   - @project.add_access(@user, :admin)
18   - end
19   -
20   - Given 'I visit project commit page' do
21   - visit project_commit_path(@project, ValidCommit::ID)
22   - end
23   -end
features/steps/project_issues.rb
... ... @@ -1,160 +0,0 @@
1   -class ProjectIssues < Spinach::FeatureSteps
2   - Given 'I should see "Release 0.4" in issues' do
3   - page.should have_content "Release 0.4"
4   - end
5   -
6   - And 'I should not see "Release 0.3" in issues' do
7   - page.should_not have_content "Release 0.3"
8   - end
9   -
10   - Given 'I click link "Closed"' do
11   - click_link "Closed"
12   - end
13   -
14   - Then 'I should see "Release 0.3" in issues' do
15   - page.should have_content "Release 0.3"
16   - end
17   -
18   - And 'I should not see "Release 0.4" in issues' do
19   - page.should_not have_content "Release 0.4"
20   - end
21   -
22   - Given 'I click link "All"' do
23   - click_link "All"
24   - end
25   -
26   - Given 'I click link "Release 0.4"' do
27   - click_link "Release 0.4"
28   - end
29   -
30   - Then 'I should see issue "Release 0.4"' do
31   - page.should have_content "Release 0.4"
32   - end
33   -
34   - Given 'I click link "New Issue"' do
35   - click_link "New Issue"
36   - end
37   -
38   - And 'I submit new issue "500 error on profile"' do
39   - fill_in "issue_title", :with => "500 error on profile"
40   - click_button "Submit new issue"
41   - end
42   -
43   - Given 'I click link "500 error on profile"' do
44   - click_link "500 error on profile"
45   - end
46   -
47   - Then 'I should see issue "500 error on profile"' do
48   - issue = Issue.find_by_title("500 error on profile")
49   - page.should have_content issue.title
50   - page.should have_content issue.author_name
51   - page.should have_content issue.project.name
52   - end
53   -
54   - Given 'I visit issue page "Release 0.4"' do
55   - issue = Issue.find_by_title("Release 0.4")
56   - visit project_issue_path(issue.project, issue)
57   - end
58   -
59   - And 'I leave a comment like "XML attached"' do
60   - fill_in "note_note", :with => "XML attached"
61   - click_button "Add Comment"
62   - end
63   -
64   - Then 'I should see comment "XML attached"' do
65   - page.should have_content "XML attached"
66   - end
67   -
68   - Given 'I fill in issue search with "Release"' do
69   - fill_in 'issue_search', with: "Release"
70   - end
71   -
72   - Given 'I fill in issue search with "Bug"' do
73   - fill_in 'issue_search', with: "Bug"
74   - end
75   -
76   - And 'I fill in issue search with "0.3"' do
77   - fill_in 'issue_search', with: "0.3"
78   - end
79   -
80   - And 'I fill in issue search with "Something"' do
81   - fill_in 'issue_search', with: "Something"
82   - end
83   -
84   - And 'I fill in issue search with ""' do
85   - page.execute_script("$('.issue_search').val('').keyup();");
86   - fill_in 'issue_search', with: ""
87   - end
88   -
89   - Given 'project "Shop" has milestone "v2.2"' do
90   - project = Project.find_by_name("Shop")
91   - milestone = Factory :milestone, :title => "v2.2", :project => project
92   -
93   - 3.times do
94   - issue = Factory :issue, :project => project, :milestone => milestone
95   - end
96   - end
97   -
98   - And 'project "Shop" has milestone "v3.0"' do
99   - project = Project.find_by_name("Shop")
100   - milestone = Factory :milestone, :title => "v3.0", :project => project
101   -
102   - 3.times do
103   - issue = Factory :issue, :project => project, :milestone => milestone
104   - end
105   - end
106   -
107   - And 'I visit project "Shop" issues page' do
108   - visit project_issues_path(Project.find_by_name("Shop"))
109   - end
110   -
111   - When 'I select milestone "v3.0"' do
112   - select "v3.0", from: "milestone_id"
113   - end
114   -
115   - Then 'I should see selected milestone with title "v3.0"' do
116   - issues_milestone_selector = "#issue_milestone_id_chzn/a"
117   - wait_until { page.has_content?("Details") }
118   - page.find(issues_milestone_selector).should have_content("v3.0")
119   - end
120   -
121   - When 'I select first assignee from "Shop" project' do
122   - project = Project.find_by_name "Shop"
123   - first_assignee = project.users.first
124   - select first_assignee.name, from: "assignee_id"
125   - end
126   -
127   - Then 'I should see first assignee from "Shop" as selected assignee' do
128   - issues_assignee_selector = "#issue_assignee_id_chzn/a"
129   - wait_until { page.has_content?("Details") }
130   - project = Project.find_by_name "Shop"
131   - assignee_name = project.users.first.name
132   - page.find(issues_assignee_selector).should have_content(assignee_name)
133   - end
134   -
135   - Given 'I sign in as a user' do
136   - login_as :user
137   - end
138   -
139   - And 'I own project "Shop"' do
140   - @project = Factory :project, :name => "Shop"
141   - @project.add_access(@user, :admin)
142   - end
143   -
144   - And 'project "Shop" have "Release 0.4" open issue' do
145   - project = Project.find_by_name("Shop")
146   - Factory.create(:issue,
147   - :title => "Release 0.4",
148   - :project => project,
149   - :author => project.users.first)
150   - end
151   -
152   - And 'project "Shop" have "Release 0.3" closed issue' do
153   - project = Project.find_by_name("Shop")
154   - Factory.create(:issue,
155   - :title => "Release 0.3",
156   - :project => project,
157   - :author => project.users.first,
158   - :closed => true)
159   - end
160   -end
features/steps/project_labels.rb
... ... @@ -1,33 +0,0 @@
1   -class ProjectLabels < Spinach::FeatureSteps
2   - Then 'I should see label "bug"' do
3   - within ".labels-table" do
4   - page.should have_content "bug"
5   - end
6   - end
7   -
8   - And 'I should see label "feature"' do
9   - within ".labels-table" do
10   - page.should have_content "feature"
11   - end
12   - end
13   -
14   - Given 'I sign in as a user' do
15   - login_as :user
16   - end
17   -
18   - And 'I own project "Shop"' do
19   - @project = Factory :project, :name => "Shop"
20   - @project.add_access(@user, :admin)
21   - end
22   -
23   - And 'project "Shop" have issues tags: "bug", "feature"' do
24   - project = Project.find_by_name("Shop")
25   - ['bug', 'feature'].each do |label|
26   - Factory :issue, project: project, label_list: label
27   - end
28   - end
29   -
30   - Given 'I visit project "Shop" labels page' do
31   - visit project_labels_path(Project.find_by_name("Shop"))
32   - end
33   -end
features/steps/project_merge_requests.rb
... ... @@ -1,102 +0,0 @@
1   -class ProjectMergeRequests < Spinach::FeatureSteps
2   - Then 'I should see "Bug NS-04" in merge requests' do
3   - page.should have_content "Bug NS-04"
4   - end
5   -
6   - And 'I should not see "Feature NS-03" in merge requests' do
7   - page.should_not have_content "Feature NS-03"
8   - end
9   -
10   - Given 'I click link "Closed"' do
11   - click_link "Closed"
12   - end
13   -
14   - Then 'I should see "Feature NS-03" in merge requests' do
15   - page.should have_content "Feature NS-03"
16   - end
17   -
18   - And 'I should not see "Bug NS-04" in merge requests' do
19   - page.should_not have_content "Bug NS-04"
20   - end
21   -
22   - Given 'I click link "All"' do
23   - click_link "All"
24   - end
25   -
26   - Given 'I click link "Bug NS-04"' do
27   - click_link "Bug NS-04"
28   - end
29   -
30   - Then 'I should see merge request "Bug NS-04"' do
31   - page.should have_content "Bug NS-04"
32   - end
33   -
34   - And 'I click link "Close"' do
35   - click_link "Close"
36   - end
37   -
38   - Then 'I should see closed merge request "Bug NS-04"' do
39   - mr = MergeRequest.find_by_title("Bug NS-04")
40   - mr.closed.should be_true
41   - page.should have_content "Closed by"
42   - end
43   -
44   - Given 'I click link "New Merge Request"' do
45   - click_link "New Merge Request"
46   - end
47   -
48   - And 'I submit new merge request "Wiki Feature"' do
49   - fill_in "merge_request_title", :with => "Wiki Feature"
50   - select "master", :from => "merge_request_source_branch"
51   - select "stable", :from => "merge_request_target_branch"
52   - click_button "Save"
53   - end
54   -
55   - Then 'I should see merge request "Wiki Feature"' do
56   - page.should have_content "Wiki Feature"
57   - end
58   -
59   - Given 'I visit merge request page "Bug NS-04"' do
60   - mr = MergeRequest.find_by_title("Bug NS-04")
61   - visit project_merge_request_path(mr.project, mr)
62   - end
63   -
64   - And 'I leave a comment like "XML attached"' do
65   - fill_in "note_note", :with => "XML attached"
66   - click_button "Add Comment"
67   - end
68   -
69   - Then 'I should see comment "XML attached"' do
70   - page.should have_content "XML attached"
71   - end
72   -
73   - Given 'I sign in as a user' do
74   - login_as :user
75   - end
76   -
77   - And 'I own project "Shop"' do
78   - @project = Factory :project, :name => "Shop"
79   - @project.add_access(@user, :admin)
80   - end
81   -
82   - And 'project "Shop" have "Bug NS-04" open merge request' do
83   - project = Project.find_by_name("Shop")
84   - Factory.create(:merge_request,
85   - :title => "Bug NS-04",
86   - :project => project,
87   - :author => project.users.first)
88   - end
89   -
90   - And 'project "Shop" have "Feature NS-03" closed merge request' do
91   - project = Project.find_by_name("Shop")
92   - Factory.create(:merge_request,
93   - :title => "Feature NS-03",
94   - :project => project,
95   - :author => project.users.first,
96   - :closed => true)
97   - end
98   -
99   - And 'I visit project "Shop" merge requests page' do
100   - visit project_merge_requests_path(Project.find_by_name("Shop"))
101   - end
102   -end
features/steps/project_milestones.rb
... ... @@ -1,51 +0,0 @@
1   -class ProjectMilestones < Spinach::FeatureSteps
2   - Then 'I should see milestone "v2.2"' do
3   - milestone = @project.milestones.find_by_title("v2.2")
4   - page.should have_content(milestone.title[0..10])
5   - page.should have_content(milestone.expires_at)
6   - page.should have_content("Browse Issues")
7   - end
8   -
9   - Given 'I click link "v2.2"' do
10   - click_link "v2.2"
11   - end
12   -
13   - Given 'I click link "New Milestone"' do
14   - click_link "New Milestone"
15   - end
16   -
17   - And 'I submit new milestone "v2.3"' do
18   - fill_in "milestone_title", :with => "v2.3"
19   - click_button "Create milestone"
20   - end
21   -
22   - Then 'I should see milestone "v2.3"' do
23   - milestone = @project.milestones.find_by_title("v2.3")
24   - page.should have_content(milestone.title[0..10])
25   - page.should have_content(milestone.expires_at)
26   - page.should have_content("Browse Issues")
27   - end
28   -
29   - Given 'I sign in as a user' do
30   - login_as :user
31   - end
32   -
33   - And 'I own project "Shop"' do
34   - @project = Factory :project, :name => "Shop"
35   - @project.add_access(@user, :admin)
36   - end
37   -
38   - And 'project "Shop" has milestone "v2.2"' do
39   - project = Project.find_by_name("Shop")
40   - milestone = Factory :milestone, :title => "v2.2", :project => project
41   -
42   - 3.times do
43   - issue = Factory :issue, :project => project, :milestone => milestone
44   - end
45   - end
46   -
47   - Given 'I visit project "Shop" milestones page' do
48   - @project = Project.find_by_name("Shop")
49   - visit project_milestones_path(@project)
50   - end
51   -end
features/steps/project_network_graph.rb
... ... @@ -1,28 +0,0 @@
1   -class ProjectNetworkGraph < Spinach::FeatureSteps
2   - Then 'page should have network graph' do
3   - page.should have_content "Project Network Graph"
4   - within ".graph" do
5   - page.should have_content "master"
6   - page.should have_content "scss_refactor..."
7   - end
8   - end
9   -
10   - Given 'I sign in as a user' do
11   - login_as :user
12   - end
13   -
14   - And 'I own project "Shop"' do
15   - @project = Factory :project, :name => "Shop"
16   - @project.add_access(@user, :admin)
17   - end
18   -
19   - And 'I visit project "Shop" network page' do
20   - project = Project.find_by_name("Shop")
21   -
22   - # Stub out find_all to speed this up (10 commits vs. 650)
23   - commits = Grit::Commit.find_all(project.repo, nil, {max_count: 10})
24   - Grit::Commit.stub(:find_all).and_return(commits)
25   -
26   - visit graph_project_path(project)
27   - end
28   -end
features/steps/project_team_management.rb
... ... @@ -1,98 +0,0 @@
1   -class ProjectTeamManagement < Spinach::FeatureSteps
2   - Then 'I should be able to see myself in team' do
3   - page.should have_content(@user.name)
4   - page.should have_content(@user.email)
5   - end
6   -
7   - And 'I should see "Sam" in team list' do
8   - user = User.find_by_name("Sam")
9   - page.should have_content(user.name)
10   - page.should have_content(user.email)
11   - end
12   -
13   - Given 'I click link "New Team Member"' do
14   - click_link "New Team Member"
15   - end
16   -
17   - And 'I select "Mike" as "Reporter"' do
18   - user = User.find_by_name("Mike")
19   - within "#new_team_member" do
20   - select user.name, :from => "user_ids"
21   - select "Reporter", :from => "project_access"
22   - end
23   - click_button "Save"
24   - end
25   -
26   - Then 'I should see "Mike" in team list as "Reporter"' do
27   - user = User.find_by_name("Mike")
28   - role_id = find(".user_#{user.id} #team_member_project_access").value
29   - role_id.should == UsersProject.access_roles["Reporter"].to_s
30   - end
31   -
32   - Given 'I should see "Sam" in team list as "Developer"' do
33   - user = User.find_by_name("Sam")
34   - role_id = find(".user_#{user.id} #team_member_project_access").value
35   - role_id.should == UsersProject.access_roles["Developer"].to_s
36   - end
37   -
38   - And 'I change "Sam" role to "Reporter"' do
39   - user = User.find_by_name("Sam")
40   - within ".user_#{user.id}" do
41   - select "Reporter", :from => "team_member_project_access"
42   - end
43   - end
44   -
45   - Then 'I visit project "Shop" team page' do
46   - visit team_project_path(Project.find_by_name("Shop"))
47   - end
48   -
49   - And 'I should see "Sam" in team list as "Reporter"' do
50   - user = User.find_by_name("Sam")
51   - role_id = find(".user_#{user.id} #team_member_project_access").value
52   - role_id.should == UsersProject.access_roles["Reporter"].to_s
53   - end
54   -
55   - Given 'I click link "Sam"' do
56   - click_link "Sam"
57   - end
58   -
59   - Then 'I should see "Sam" team profile' do
60   - user = User.find_by_name("Sam")
61   - page.should have_content(user.name)
62   - page.should have_content(user.email)
63   - page.should have_content("To team list")
64   - end
65   -
66   - And 'I click link "Remove from team"' do
67   - click_link "Remove from team"
68   - end
69   -
70   - And 'I should not see "Sam" in team list' do
71   - user = User.find_by_name("Sam")
72   - page.should_not have_content(user.name)
73   - page.should_not have_content(user.email)
74   - end
75   -
76   - Given 'I sign in as a user' do
77   - login_as :user
78   - end
79   -
80   - And 'I own project "Shop"' do
81   - @project = Factory :project, :name => "Shop"
82   - @project.add_access(@user, :admin)
83   - end
84   -
85   - And 'gitlab user "Mike"' do
86   - Factory :user, :name => "Mike"
87   - end
88   -
89   - And 'gitlab user "Sam"' do
90   - Factory :user, :name => "Sam"
91   - end
92   -
93   - And '"Sam" is "Shop" developer' do
94   - user = User.find_by_name("Sam")
95   - project = Project.find_by_name("Shop")
96   - project.add_access(user, :write)
97   - end
98   -end
features/steps/project_wall.rb
... ... @@ -1,24 +0,0 @@
1   -class ProjectWall < Spinach::FeatureSteps
2   - Given 'I write new comment "my special test message"' do
3   - fill_in "note_note", :with => "my special test message"
4   - click_button "Add Comment"
5   - end
6   -
7   - Then 'I should see project wall note "my special test message"' do
8   - page.should have_content "my special test message"
9   - end
10   -
11   - Then 'I visit project "Shop" wall page' do
12   - project = Project.find_by_name("Shop")
13   - visit wall_project_path(project)
14   - end
15   -
16   - Given 'I signin as a user' do
17   - login_as :user
18   - end
19   -
20   - And 'I own project "Shop"' do
21   - @project = Factory :project, :name => "Shop"
22   - @project.add_access(@user, :admin)
23   - end
24   -end
features/steps/project_wiki.rb
... ... @@ -1,37 +0,0 @@
1   -class ProjectWiki < Spinach::FeatureSteps
2   - Given 'I create Wiki page' do
3   - fill_in "Title", :with => 'Test title'
4   - fill_in "Content", :with => '[link test](test)'
5   - click_on "Save"
6   - end
7   -
8   - Then 'I should see newly created wiki page' do
9   - page.should have_content "Test title"
10   - page.should have_content "link test"
11   -
12   - click_link "link test"
13   - page.should have_content "Editing page"
14   - end
15   -
16   - And 'I leave a comment like "XML attached"' do
17   - fill_in "note_note", :with => "XML attached"
18   - click_button "Add Comment"
19   - end
20   -
21   - Then 'I should see comment "XML attached"' do
22   - page.should have_content "XML attached"
23   - end
24   -
25   - Given 'I sign in as a user' do
26   - login_as :user
27   - end
28   -
29   - And 'I own project "Shop"' do
30   - @project = Factory :project, :name => "Shop"
31   - @project.add_access(@user, :admin)
32   - end
33   -
34   - Given 'I visit project wiki page' do
35   - visit project_wiki_path(@project, :index)
36   - end
37   -end
features/steps/shared/authentication.rb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +require Rails.root.join('spec', 'support', 'login_helpers')
  2 +
  3 +module SharedAuthentication
  4 + include Spinach::DSL
  5 + include LoginHelpers
  6 +
  7 + Given 'I sign in as a user' do
  8 + login_as :user
  9 + end
  10 +end
... ...
features/steps/shared/note.rb 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +module SharedNote
  2 + include Spinach::DSL
  3 +
  4 + Given 'I leave a comment like "XML attached"' do
  5 + fill_in "note_note", :with => "XML attached"
  6 + click_button "Add Comment"
  7 + end
  8 +
  9 + Then 'I should see comment "XML attached"' do
  10 + page.should have_content "XML attached"
  11 + end
  12 +
  13 + Given 'I write new comment "my special test message"' do
  14 + fill_in "note_note", :with => "my special test message"
  15 + click_button "Add Comment"
  16 + end
  17 +
  18 + Then 'I should see project wall note "my special test message"' do
  19 + page.should have_content "my special test message"
  20 + end
  21 +end
... ...
features/steps/shared/paths.rb 0 → 100644
... ... @@ -0,0 +1,112 @@
  1 +module SharedPaths
  2 + include Spinach::DSL
  3 +
  4 + And 'I visit dashboard search page' do
  5 + visit search_path
  6 + end
  7 +
  8 + And 'I visit dashboard merge requests page' do
  9 + visit dashboard_merge_requests_path
  10 + end
  11 +
  12 + And 'I visit dashboard issues page' do
  13 + visit dashboard_issues_path
  14 + end
  15 +
  16 + When 'I visit dashboard page' do
  17 + visit dashboard_path
  18 + end
  19 +
  20 + Given 'I visit profile page' do
  21 + visit profile_path
  22 + end
  23 +
  24 + Given 'I visit profile password page' do
  25 + visit profile_password_path
  26 + end
  27 +
  28 + Given 'I visit profile token page' do
  29 + visit profile_token_path
  30 + end
  31 +
  32 + When 'I visit new project page' do
  33 + visit new_project_path
  34 + end
  35 +
  36 + And 'I visit project "Shop" page' do
  37 + project = Project.find_by_name("Shop")
  38 + visit project_path(project)
  39 + end
  40 +
  41 + Given 'I visit project branches page' do
  42 + visit branches_project_repository_path(@project)
  43 + end
  44 +
  45 + Given 'I visit compare refs page' do
  46 + visit compare_project_commits_path(@project)
  47 + end
  48 +
  49 + Given 'I visit project commits page' do
  50 + visit project_commits_path(@project)
  51 + end
  52 +
  53 + Given 'I visit project source page' do
  54 + visit tree_project_ref_path(@project, @project.root_ref)
  55 + end
  56 +
  57 + Given 'I visit blob file from repo' do
  58 + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
  59 + end
  60 +
  61 + Given 'I visit project source page for "8470d70"' do
  62 + visit tree_project_ref_path(@project, "8470d70")
  63 + end
  64 +
  65 + Given 'I visit project tags page' do
  66 + visit tags_project_repository_path(@project)
  67 + end
  68 +
  69 + Given 'I visit project commit page' do
  70 + visit project_commit_path(@project, ValidCommit::ID)
  71 + end
  72 +
  73 + And 'I visit project "Shop" issues page' do
  74 + visit project_issues_path(Project.find_by_name("Shop"))
  75 + end
  76 +
  77 + Given 'I visit issue page "Release 0.4"' do
  78 + issue = Issue.find_by_title("Release 0.4")
  79 + visit project_issue_path(issue.project, issue)
  80 + end
  81 +
  82 + Given 'I visit project "Shop" labels page' do
  83 + visit project_labels_path(Project.find_by_name("Shop"))
  84 + end
  85 +
  86 + Given 'I visit merge request page "Bug NS-04"' do
  87 + mr = MergeRequest.find_by_title("Bug NS-04")
  88 + visit project_merge_request_path(mr.project, mr)
  89 + end
  90 +
  91 + And 'I visit project "Shop" merge requests page' do
  92 + visit project_merge_requests_path(Project.find_by_name("Shop"))
  93 + end
  94 +
  95 + Given 'I visit project "Shop" milestones page' do
  96 + @project = Project.find_by_name("Shop")
  97 + visit project_milestones_path(@project)
  98 + end
  99 +
  100 + Then 'I visit project "Shop" team page' do
  101 + visit team_project_path(Project.find_by_name("Shop"))
  102 + end
  103 +
  104 + Then 'I visit project "Shop" wall page' do
  105 + project = Project.find_by_name("Shop")
  106 + visit wall_project_path(project)
  107 + end
  108 +
  109 + Given 'I visit project wiki page' do
  110 + visit project_wiki_path(@project, :index)
  111 + end
  112 +end
... ...
features/steps/shared/project.rb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +module SharedProject
  2 + include Spinach::DSL
  3 +
  4 + And 'I own project "Shop"' do
  5 + @project = Factory :project, :name => "Shop"
  6 + @project.add_access(@user, :admin)
  7 + end
  8 +end
... ...
features/support/env.rb
... ... @@ -5,11 +5,12 @@ require &#39;rspec&#39;
5 5 require 'database_cleaner'
6 6 require 'spinach/capybara'
7 7  
8   -%w(gitolite_stub login_helpers stubbed_repository valid_commit).each do |f|
  8 +%w(gitolite_stub stubbed_repository valid_commit).each do |f|
9 9 require Rails.root.join('spec', 'support', f)
10 10 end
11 11  
12   -include LoginHelpers
  12 +Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file}
  13 +
13 14 include GitoliteStub
14 15  
15 16 WebMock.allow_net_connect!
... ...