Commit 1281c122c7a4edf2873aad13c22ea09ce6dc57c3

Authored by Dmitriy Zaporozhets
1 parent b846ac10

Issues cucumber. refactored step_definitoons

features/projects/issues/issues.feature
@@ -7,6 +7,32 @@ Feature: Issues @@ -7,6 +7,32 @@ Feature: Issues
7 And I visit project "Shop" issues page 7 And I visit project "Shop" issues page
8 8
9 Scenario: I should see open issues 9 Scenario: I should see open issues
10 - Given I should see "Release 0.4" open issue  
11 - And I should not see "Release 0.3" closed issue 10 + Given I should see "Release 0.4" in issues
  11 + And I should not see "Release 0.3" in issues
12 12
  13 + Scenario: I should see closed issues
  14 + Given I click link "Closed"
  15 + Then I should see "Release 0.3" in issues
  16 + And I should not see "Release 0.4" in issues
  17 +
  18 + Scenario: I should see all issues
  19 + Given I click link "All"
  20 + Then I should see "Release 0.3" in issues
  21 + And I should see "Release 0.4" in issues
  22 +
  23 + Scenario: I visit issue page
  24 + Given I click link "Release 0.4"
  25 + Then I should see issue "Release 0.4"
  26 +
  27 + @javascript
  28 + Scenario: I submit new unassigned issue
  29 + Given I click link "New Issue"
  30 + And I submit new issue "500 error on profile"
  31 + Given I click link "500 error on profile"
  32 + Then I should see issue "500 error on profile"
  33 +
  34 + @javascript
  35 + Scenario: I comment issue
  36 + Given I visit issue page "Release 0.4"
  37 + And I leave a comment like "XML attached"
  38 + Then I should see commetn "XML attached"
features/step_definitions/browse_code_steps.rb
@@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
1 -Given /^I visit project source page$/ do  
2 - visit tree_project_ref_path(@project, @project.root_ref)  
3 -end  
4 -  
5 -Then /^I should see files from repository$/ do  
6 - page.should have_content("app")  
7 - page.should have_content("History")  
8 - page.should have_content("Gemfile")  
9 -end  
10 -  
11 -Given /^I visit project source page for "(.*?)"$/ do |arg1|  
12 - visit tree_project_ref_path(@project, arg1)  
13 -end  
14 -  
15 -Then /^I should see files from repository for "(.*?)"$/ do |arg1|  
16 - current_path.should == tree_project_ref_path(@project, arg1)  
17 - page.should have_content("app")  
18 - page.should have_content("History")  
19 - page.should have_content("Gemfile")  
20 -end  
21 -  
22 -Given /^I click on file from repo$/ do  
23 - click_link "Gemfile"  
24 -end  
25 -  
26 -Then /^I should see it content$/ do  
27 - page.should have_content("rubygems.org")  
28 -end  
29 -  
30 -Given /^I click on raw button$/ do  
31 - click_link "raw"  
32 -end  
33 -  
34 -Given /^I visit blob file from repo$/ do  
35 - visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)  
36 -end  
37 -  
38 -Then /^I should see raw file content$/ do  
39 - page.source.should == ValidCommit::BLOB_FILE  
40 -end  
41 -  
42 -Given /^I click blame button$/ do  
43 - click_link "blame"  
44 -end  
45 -  
46 -Then /^I should see git file blame$/ do  
47 - page.should have_content("rubygems.org")  
48 - page.should have_content("Dmitriy Zaporozhets")  
49 - page.should have_content("bc3735004cb Moving to rails 3.2")  
50 -end  
features/step_definitions/profile/profile_keys_steps.rb 0 → 100644
@@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
  1 +Given /^I visit profile keys page$/ do
  2 + visit keys_path
  3 +end
  4 +
  5 +Then /^I should see my ssh keys$/ do
  6 + @user.keys.each do |key|
  7 + page.should have_content(key.title)
  8 + end
  9 +end
  10 +
  11 +Given /^I have ssh keys:$/ do |table|
  12 + table.hashes.each do |row|
  13 + Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}"
  14 + end
  15 +end
  16 +
  17 +Given /^I submit new ssh key "(.*?)"$/ do |arg1|
  18 + fill_in "key_title", :with => arg1
  19 + fill_in "key_key", :with => "publickey234="
  20 + click_button "Save"
  21 +end
  22 +
  23 +Then /^I should see new ssh key "(.*?)"$/ do |arg1|
  24 + key = Key.find_by_title(arg1)
  25 + page.should have_content(key.title)
  26 + page.should have_content(key.key)
  27 + current_path.should == key_path(key)
  28 +end
  29 +
  30 +Then /^I should not see "(.*?)" ssh key$/ do |arg1|
  31 + within "#keys-table" do
  32 + page.should_not have_content(arg1)
  33 + end
  34 +end
features/step_definitions/profile/profile_steps.rb 0 → 100644
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
  1 +Given /^I visit profile page$/ do
  2 + visit profile_path
  3 +end
  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 +Given /^I visit profile password page$/ do
  12 + visit profile_password_path
  13 +end
  14 +
  15 +Then /^I change my password$/ do
  16 + fill_in "user_password", :with => "222333"
  17 + fill_in "user_password_confirmation", :with => "222333"
  18 + click_button "Save"
  19 +end
  20 +
  21 +Then /^I should be redirected to sign in page$/ do
  22 + current_path.should == new_user_session_path
  23 +end
  24 +
  25 +Given /^I visit profile token page$/ do
  26 + visit profile_token_path
  27 +end
  28 +
  29 +Then /^I reset my token$/ do
  30 + @old_token = @user.private_token
  31 + click_button "Reset"
  32 +end
  33 +
  34 +Then /^I should see new token$/ do
  35 + find("#token").value.should_not == @old_token
  36 + find("#token").value.should == @user.reload.private_token
  37 +end
  38 +
  39 +Then /^I change my contact info$/ do
  40 + fill_in "user_skype", :with => "testskype"
  41 + fill_in "user_linkedin", :with => "testlinkedin"
  42 + fill_in "user_twitter", :with => "testtwitter"
  43 + click_button "Save"
  44 + @user.reload
  45 +end
  46 +
  47 +Then /^I should see new contact info$/ do
  48 + @user.skype.should == 'testskype'
  49 + @user.linkedin.should == 'testlinkedin'
  50 + @user.twitter.should == 'testtwitter'
  51 +end
features/step_definitions/profile_keys_steps.rb
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -Given /^I visit profile keys page$/ do  
2 - visit keys_path  
3 -end  
4 -  
5 -Then /^I should see my ssh keys$/ do  
6 - @user.keys.each do |key|  
7 - page.should have_content(key.title)  
8 - end  
9 -end  
10 -  
11 -Given /^I have ssh keys:$/ do |table|  
12 - table.hashes.each do |row|  
13 - Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}"  
14 - end  
15 -end  
16 -  
17 -Given /^I submit new ssh key "(.*?)"$/ do |arg1|  
18 - fill_in "key_title", :with => arg1  
19 - fill_in "key_key", :with => "publickey234="  
20 - click_button "Save"  
21 -end  
22 -  
23 -Then /^I should see new ssh key "(.*?)"$/ do |arg1|  
24 - key = Key.find_by_title(arg1)  
25 - page.should have_content(key.title)  
26 - page.should have_content(key.key)  
27 - current_path.should == key_path(key)  
28 -end  
29 -  
30 -Then /^I should not see "(.*?)" ssh key$/ do |arg1|  
31 - within "#keys-table" do  
32 - page.should_not have_content(arg1)  
33 - end  
34 -end  
features/step_definitions/profile_steps.rb
@@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
1 -Given /^I visit profile page$/ do  
2 - visit profile_path  
3 -end  
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 -Given /^I visit profile password page$/ do  
12 - visit profile_password_path  
13 -end  
14 -  
15 -Then /^I change my password$/ do  
16 - fill_in "user_password", :with => "222333"  
17 - fill_in "user_password_confirmation", :with => "222333"  
18 - click_button "Save"  
19 -end  
20 -  
21 -Then /^I should be redirected to sign in page$/ do  
22 - current_path.should == new_user_session_path  
23 -end  
24 -  
25 -Given /^I visit profile token page$/ do  
26 - visit profile_token_path  
27 -end  
28 -  
29 -Then /^I reset my token$/ do  
30 - @old_token = @user.private_token  
31 - click_button "Reset"  
32 -end  
33 -  
34 -Then /^I should see new token$/ do  
35 - find("#token").value.should_not == @old_token  
36 - find("#token").value.should == @user.reload.private_token  
37 -end  
38 -  
39 -Then /^I change my contact info$/ do  
40 - fill_in "user_skype", :with => "testskype"  
41 - fill_in "user_linkedin", :with => "testlinkedin"  
42 - fill_in "user_twitter", :with => "testtwitter"  
43 - click_button "Save"  
44 - @user.reload  
45 -end  
46 -  
47 -Then /^I should see new contact info$/ do  
48 - @user.skype.should == 'testskype'  
49 - @user.linkedin.should == 'testlinkedin'  
50 - @user.twitter.should == 'testtwitter'  
51 -end  
features/step_definitions/project/browse_code_steps.rb 0 → 100644
@@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
  1 +Given /^I visit project source page$/ do
  2 + visit tree_project_ref_path(@project, @project.root_ref)
  3 +end
  4 +
  5 +Then /^I should see files from repository$/ do
  6 + page.should have_content("app")
  7 + page.should have_content("History")
  8 + page.should have_content("Gemfile")
  9 +end
  10 +
  11 +Given /^I visit project source page for "(.*?)"$/ do |arg1|
  12 + visit tree_project_ref_path(@project, arg1)
  13 +end
  14 +
  15 +Then /^I should see files from repository for "(.*?)"$/ do |arg1|
  16 + current_path.should == tree_project_ref_path(@project, arg1)
  17 + page.should have_content("app")
  18 + page.should have_content("History")
  19 + page.should have_content("Gemfile")
  20 +end
  21 +
  22 +Given /^I click on file from repo$/ do
  23 + click_link "Gemfile"
  24 +end
  25 +
  26 +Then /^I should see it content$/ do
  27 + page.should have_content("rubygems.org")
  28 +end
  29 +
  30 +Given /^I click on raw button$/ do
  31 + click_link "raw"
  32 +end
  33 +
  34 +Given /^I visit blob file from repo$/ do
  35 + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
  36 +end
  37 +
  38 +Then /^I should see raw file content$/ do
  39 + page.source.should == ValidCommit::BLOB_FILE
  40 +end
  41 +
  42 +Given /^I click blame button$/ do
  43 + click_link "blame"
  44 +end
  45 +
  46 +Then /^I should see git file blame$/ do
  47 + page.should have_content("rubygems.org")
  48 + page.should have_content("Dmitriy Zaporozhets")
  49 + page.should have_content("bc3735004cb Moving to rails 3.2")
  50 +end
features/step_definitions/project/project_commits_steps.rb 0 → 100644
@@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
  1 +Given /^I visit project commits page$/ do
  2 + visit project_commits_path(@project)
  3 +end
  4 +
  5 +Then /^I see project commits$/ do
  6 + current_path.should == project_commits_path(@project)
  7 +
  8 + commit = @project.commit
  9 + page.should have_content(@project.name)
  10 + page.should have_content(commit.message)
  11 + page.should have_content(commit.id.to_s[0..5])
  12 +end
  13 +
  14 +Given /^I click atom feed link$/ do
  15 + click_link "Feed"
  16 +end
  17 +
  18 +Then /^I see commits atom feed$/ do
  19 + commit = CommitDecorator.decorate(@project.commit)
  20 + page.response_headers['Content-Type'].should have_content("application/atom+xml")
  21 + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
  22 + page.body.should have_selector("author email", :text => commit.author_email)
  23 + page.body.should have_selector("entry summary", :text => commit.description)
  24 +end
  25 +
  26 +Given /^I click on commit link$/ do
  27 + visit project_commit_path(@project, ValidCommit::ID)
  28 +end
  29 +
  30 +Then /^I see commit info$/ do
  31 + page.should have_content ValidCommit::MESSAGE
  32 + page.should have_content "Showing 1 changed file"
  33 +end
  34 +
  35 +Given /^I visit compare refs page$/ do
  36 + visit compare_project_commits_path(@project)
  37 +end
  38 +
  39 +Given /^I fill compare fields with refs$/ do
  40 + fill_in "from", :with => "master"
  41 + fill_in "to", :with => "stable"
  42 + click_button "Compare"
  43 +end
  44 +
  45 +Given /^I see compared refs$/ do
  46 + page.should have_content "Commits (27)"
  47 + page.should have_content "Compare View"
  48 + page.should have_content "Showing 73 changed files"
  49 +end
  50 +
  51 +Given /^I visit project branches page$/ do
  52 + visit branches_project_repository_path(@project)
  53 +end
  54 +
  55 +Given /^I visit project commit page$/ do
  56 + visit project_commit_path(@project, ValidCommit::ID)
  57 +end
  58 +
  59 +Given /^I visit project tags page$/ do
  60 + visit tags_project_repository_path(@project)
  61 +end
features/step_definitions/project/project_issues_steps.rb 0 → 100644
@@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
  1 +Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2|
  2 + project = Project.find_by_name(arg1)
  3 + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first)
  4 +end
  5 +
  6 +Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2|
  7 + project = Project.find_by_name(arg1)
  8 + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true)
  9 +end
  10 +
  11 +Given /^I visit project "(.*?)" issues page$/ do |arg1|
  12 + visit project_issues_path(Project.find_by_name(arg1))
  13 +end
  14 +
  15 +Given /^I should see "(.*?)" in issues$/ do |arg1|
  16 + page.should have_content arg1
  17 +end
  18 +
  19 +Given /^I should not see "(.*?)" in issues$/ do |arg1|
  20 + page.should_not have_content arg1
  21 +end
  22 +
  23 +Then /^I should see issue "(.*?)"$/ do |arg1|
  24 + issue = Issue.find_by_title(arg1)
  25 + page.should have_content issue.title
  26 + page.should have_content issue.author_name
  27 + page.should have_content issue.project.name
  28 +end
  29 +
  30 +Given /^I visit issue page "(.*?)"$/ do |arg1|
  31 + issue = Issue.find_by_title(arg1)
  32 + visit project_issue_path(issue.project, issue)
  33 +end
  34 +
  35 +Given /^I leave a comment like "(.*?)"$/ do |arg1|
  36 + fill_in "note_note", :with => arg1
  37 + click_button "Add Comment"
  38 +end
  39 +
  40 +Then /^I should see commetn "(.*?)"$/ do |arg1|
  41 + page.should have_content(arg1)
  42 +end
  43 +
  44 +Given /^I submit new issue "(.*?)"$/ do |arg1|
  45 + fill_in "issue_title", :with => arg1
  46 + click_button "Submit new issue"
  47 +end
features/step_definitions/project/project_merge_requests_steps.rb 0 → 100644
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
  1 +Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2|
  2 + project = Project.find_by_name(arg1)
  3 +
  4 + milestone = Factory :milestone,
  5 + :title => arg2,
  6 + :project => project
  7 +
  8 + 3.times do |i|
  9 + issue = Factory :issue,
  10 + :project => project,
  11 + :milestone => milestone
  12 + end
  13 +end
  14 +
  15 +Given /^I visit project "(.*?)" milestones page$/ do |arg1|
  16 + @project = Project.find_by_name(arg1)
  17 + visit project_milestones_path(@project)
  18 +end
  19 +
  20 +Then /^I should see active milestones$/ do
  21 + milestone = @project.milestones.first
  22 + page.should have_content(milestone.title[0..10])
  23 + page.should have_content(milestone.expires_at)
  24 + page.should have_content("Browse Issues")
  25 +end
  26 +
  27 +Then /^I should see milestone "(.*?)"$/ do |arg1|
  28 + milestone = @project.milestones.find_by_title(arg1)
  29 + page.should have_content(milestone.title[0..10])
  30 + page.should have_content(milestone.expires_at)
  31 + page.should have_content("Browse Issues")
  32 +end
  33 +
  34 +Given /^I submit new milestone "(.*?)"$/ do |arg1|
  35 + fill_in "milestone_title", :with => arg1
  36 + click_button "Create milestone"
  37 +end
  38 +
features/step_definitions/project/project_team_steps.rb 0 → 100644
@@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
  1 +Given /^gitlab user "(.*?)"$/ do |arg1|
  2 + Factory :user, :name => arg1
  3 +end
  4 +
  5 +Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2|
  6 + user = User.find_by_name(arg1)
  7 + project = Project.find_by_name(arg2)
  8 + project.add_access(user, :write)
  9 +end
  10 +
  11 +Given /^I visit project "(.*?)" team page$/ do |arg1|
  12 + visit team_project_path(Project.find_by_name(arg1))
  13 +end
  14 +
  15 +Then /^I should be able to see myself in team$/ do
  16 + page.should have_content(@user.name)
  17 + page.should have_content(@user.email)
  18 +end
  19 +
  20 +Then /^I should see "(.*?)" in team list$/ do |arg1|
  21 + user = User.find_by_name(arg1)
  22 + page.should have_content(user.name)
  23 + page.should have_content(user.email)
  24 +end
  25 +
  26 +Given /^I click link "(.*?)"$/ do |arg1|
  27 + click_link arg1
  28 +end
  29 +
  30 +Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2|
  31 + user = User.find_by_name(arg1)
  32 + within "#new_team_member" do
  33 + select user.name, :from => "team_member_user_id"
  34 + select arg2, :from => "team_member_project_access"
  35 + end
  36 + click_button "Save"
  37 +end
  38 +
  39 +Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2|
  40 + user = User.find_by_name(arg1)
  41 + role_id = find(".user_#{user.id} #team_member_project_access").value
  42 + role_id.should == UsersProject.access_roles[arg2].to_s
  43 +end
  44 +
  45 +Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2|
  46 + user = User.find_by_name(arg1)
  47 + within ".user_#{user.id}" do
  48 + select arg2, :from => "team_member_project_access"
  49 + end
  50 +end
  51 +
  52 +Then /^I should see "(.*?)" team profile$/ do |arg1|
  53 + user = User.find_by_name(arg1)
  54 + page.should have_content(user.name)
  55 + page.should have_content(user.email)
  56 + page.should have_content("To team list")
  57 +end
  58 +
  59 +Then /^I should not see "(.*?)" in team list$/ do |arg1|
  60 + user = User.find_by_name(arg1)
  61 + page.should_not have_content(user.name)
  62 + page.should_not have_content(user.email)
  63 +end
features/step_definitions/project/project_wiki_steps.rb 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +Given /^I visit project wiki page$/ do
  2 + visit project_wiki_path(@project, :index)
  3 +end
  4 +
  5 +Given /^I create Wiki page$/ do
  6 + fill_in "Title", :with => 'Test title'
  7 + fill_in "Content", :with => '[link test](test)'
  8 + click_on "Save"
  9 +end
  10 +
  11 +Then /^I should see newly created wiki page$/ do
  12 + page.should have_content("Test title")
  13 + page.should have_content("link test")
  14 +
  15 + click_link "link test"
  16 +
  17 + page.should have_content("Editing page")
  18 +end
features/step_definitions/project/projects_steps.rb 0 → 100644
@@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
  1 +include LoginMacros
  2 +
  3 +Given /^I signin as a user$/ do
  4 + login_as :user
  5 +end
  6 +
  7 +When /^I visit new project page$/ do
  8 + visit new_project_path
  9 +end
  10 +
  11 +When /^fill project form with valid data$/ do
  12 + fill_in 'project_name', :with => 'NewProject'
  13 + fill_in 'project_code', :with => 'NPR'
  14 + fill_in 'project_path', :with => 'newproject'
  15 + click_button "Create project"
  16 +end
  17 +
  18 +Then /^I should see project page$/ do
  19 + current_path.should == project_path(Project.last)
  20 + page.should have_content('NewProject')
  21 +end
  22 +
  23 +Then /^I should see empty project instuctions$/ do
  24 + page.should have_content("git init")
  25 + page.should have_content("git remote")
  26 + page.should have_content(Project.last.url_to_repo)
  27 +end
  28 +
  29 +Given /^I own project "(.*?)"$/ do |arg1|
  30 + @project = Factory :project, :name => arg1
  31 + @project.add_access(@user, :admin)
  32 +end
  33 +
  34 +Given /^I visit project "(.*?)" wall page$/ do |arg1|
  35 + project = Project.find_by_name(arg1)
  36 + visit wall_project_path(project)
  37 +end
  38 +
  39 +Then /^I should see project wall note "(.*?)"$/ do |arg1|
  40 + page.should have_content arg1
  41 +end
  42 +
  43 +Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2|
  44 + project = Project.find_by_name(arg1)
  45 + project.notes.create(:note => arg1, :author => project.users.first)
  46 +end
  47 +
  48 +Given /^I write new comment "(.*?)"$/ do |arg1|
  49 + fill_in "note_note", :with => arg1
  50 + click_button "Add Comment"
  51 +end
  52 +
  53 +Given /^I visit project "(.*?)" network page$/ do |arg1|
  54 + project = Project.find_by_name(arg1)
  55 + visit graph_project_path(project)
  56 +end
  57 +
  58 +Given /^show me page$/ do
  59 + save_and_open_page
  60 +end
  61 +
  62 +Given /^page should have network graph$/ do
  63 + page.should have_content "Project Network Graph"
  64 + within ".graph" do
  65 + page.should have_content "stable"
  66 + page.should have_content "notes_refacto..."
  67 + end
  68 +end
features/step_definitions/project_commits_steps.rb
@@ -1,61 +0,0 @@ @@ -1,61 +0,0 @@
1 -Given /^I visit project commits page$/ do  
2 - visit project_commits_path(@project)  
3 -end  
4 -  
5 -Then /^I see project commits$/ do  
6 - current_path.should == project_commits_path(@project)  
7 -  
8 - commit = @project.commit  
9 - page.should have_content(@project.name)  
10 - page.should have_content(commit.message)  
11 - page.should have_content(commit.id.to_s[0..5])  
12 -end  
13 -  
14 -Given /^I click atom feed link$/ do  
15 - click_link "Feed"  
16 -end  
17 -  
18 -Then /^I see commits atom feed$/ do  
19 - commit = CommitDecorator.decorate(@project.commit)  
20 - page.response_headers['Content-Type'].should have_content("application/atom+xml")  
21 - page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")  
22 - page.body.should have_selector("author email", :text => commit.author_email)  
23 - page.body.should have_selector("entry summary", :text => commit.description)  
24 -end  
25 -  
26 -Given /^I click on commit link$/ do  
27 - visit project_commit_path(@project, ValidCommit::ID)  
28 -end  
29 -  
30 -Then /^I see commit info$/ do  
31 - page.should have_content ValidCommit::MESSAGE  
32 - page.should have_content "Showing 1 changed file"  
33 -end  
34 -  
35 -Given /^I visit compare refs page$/ do  
36 - visit compare_project_commits_path(@project)  
37 -end  
38 -  
39 -Given /^I fill compare fields with refs$/ do  
40 - fill_in "from", :with => "master"  
41 - fill_in "to", :with => "stable"  
42 - click_button "Compare"  
43 -end  
44 -  
45 -Given /^I see compared refs$/ do  
46 - page.should have_content "Commits (27)"  
47 - page.should have_content "Compare View"  
48 - page.should have_content "Showing 73 changed files"  
49 -end  
50 -  
51 -Given /^I visit project branches page$/ do  
52 - visit branches_project_repository_path(@project)  
53 -end  
54 -  
55 -Given /^I visit project commit page$/ do  
56 - visit project_commit_path(@project, ValidCommit::ID)  
57 -end  
58 -  
59 -Given /^I visit project tags page$/ do  
60 - visit tags_project_repository_path(@project)  
61 -end  
features/step_definitions/project_issues_steps.rb
@@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
1 -Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2|  
2 - project = Project.find_by_name(arg1)  
3 - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first)  
4 -end  
5 -  
6 -Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2|  
7 - project = Project.find_by_name(arg1)  
8 - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true)  
9 -end  
10 -  
11 -Given /^I visit project "(.*?)" issues page$/ do |arg1|  
12 - visit project_issues_path(Project.find_by_name(arg1))  
13 -end  
14 -  
15 -Given /^I should see "(.*?)" open issue$/ do |arg1|  
16 - page.should have_content arg1  
17 -end  
18 -  
19 -Given /^I should not see "(.*?)" closed issue$/ do |arg1|  
20 - page.should_not have_content arg1  
21 -end  
22 -  
features/step_definitions/project_merge_requests_steps.rb
@@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
1 -Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2|  
2 - project = Project.find_by_name(arg1)  
3 -  
4 - milestone = Factory :milestone,  
5 - :title => arg2,  
6 - :project => project  
7 -  
8 - 3.times do |i|  
9 - issue = Factory :issue,  
10 - :project => project,  
11 - :milestone => milestone  
12 - end  
13 -end  
14 -  
15 -Given /^I visit project "(.*?)" milestones page$/ do |arg1|  
16 - @project = Project.find_by_name(arg1)  
17 - visit project_milestones_path(@project)  
18 -end  
19 -  
20 -Then /^I should see active milestones$/ do  
21 - milestone = @project.milestones.first  
22 - page.should have_content(milestone.title[0..10])  
23 - page.should have_content(milestone.expires_at)  
24 - page.should have_content("Browse Issues")  
25 -end  
26 -  
27 -Then /^I should see milestone "(.*?)"$/ do |arg1|  
28 - milestone = @project.milestones.find_by_title(arg1)  
29 - page.should have_content(milestone.title[0..10])  
30 - page.should have_content(milestone.expires_at)  
31 - page.should have_content("Browse Issues")  
32 -end  
33 -  
34 -Given /^I submit new milestone "(.*?)"$/ do |arg1|  
35 - fill_in "milestone_title", :with => arg1  
36 - click_button "Create milestone"  
37 -end  
38 -  
features/step_definitions/project_team_steps.rb
@@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
1 -Given /^gitlab user "(.*?)"$/ do |arg1|  
2 - Factory :user, :name => arg1  
3 -end  
4 -  
5 -Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2|  
6 - user = User.find_by_name(arg1)  
7 - project = Project.find_by_name(arg2)  
8 - project.add_access(user, :write)  
9 -end  
10 -  
11 -Given /^I visit project "(.*?)" team page$/ do |arg1|  
12 - visit team_project_path(Project.find_by_name(arg1))  
13 -end  
14 -  
15 -Then /^I should be able to see myself in team$/ do  
16 - page.should have_content(@user.name)  
17 - page.should have_content(@user.email)  
18 -end  
19 -  
20 -Then /^I should see "(.*?)" in team list$/ do |arg1|  
21 - user = User.find_by_name(arg1)  
22 - page.should have_content(user.name)  
23 - page.should have_content(user.email)  
24 -end  
25 -  
26 -Given /^I click link "(.*?)"$/ do |arg1|  
27 - click_link arg1  
28 -end  
29 -  
30 -Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2|  
31 - user = User.find_by_name(arg1)  
32 - within "#new_team_member" do  
33 - select user.name, :from => "team_member_user_id"  
34 - select arg2, :from => "team_member_project_access"  
35 - end  
36 - click_button "Save"  
37 -end  
38 -  
39 -Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2|  
40 - user = User.find_by_name(arg1)  
41 - role_id = find(".user_#{user.id} #team_member_project_access").value  
42 - role_id.should == UsersProject.access_roles[arg2].to_s  
43 -end  
44 -  
45 -Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2|  
46 - user = User.find_by_name(arg1)  
47 - within ".user_#{user.id}" do  
48 - select arg2, :from => "team_member_project_access"  
49 - end  
50 -end  
51 -  
52 -Then /^I should see "(.*?)" team profile$/ do |arg1|  
53 - user = User.find_by_name(arg1)  
54 - page.should have_content(user.name)  
55 - page.should have_content(user.email)  
56 - page.should have_content("To team list")  
57 -end  
58 -  
59 -Then /^I should not see "(.*?)" in team list$/ do |arg1|  
60 - user = User.find_by_name(arg1)  
61 - page.should_not have_content(user.name)  
62 - page.should_not have_content(user.email)  
63 -end  
features/step_definitions/project_wiki_steps.rb
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -Given /^I visit project wiki page$/ do  
2 - visit project_wiki_path(@project, :index)  
3 -end  
4 -  
5 -Given /^I create Wiki page$/ do  
6 - fill_in "Title", :with => 'Test title'  
7 - fill_in "Content", :with => '[link test](test)'  
8 - click_on "Save"  
9 -end  
10 -  
11 -Then /^I should see newly created wiki page$/ do  
12 - page.should have_content("Test title")  
13 - page.should have_content("link test")  
14 -  
15 - click_link "link test"  
16 -  
17 - page.should have_content("Editing page")  
18 -end  
features/step_definitions/projects_steps.rb
@@ -1,68 +0,0 @@ @@ -1,68 +0,0 @@
1 -include LoginMacros  
2 -  
3 -Given /^I signin as a user$/ do  
4 - login_as :user  
5 -end  
6 -  
7 -When /^I visit new project page$/ do  
8 - visit new_project_path  
9 -end  
10 -  
11 -When /^fill project form with valid data$/ do  
12 - fill_in 'project_name', :with => 'NewProject'  
13 - fill_in 'project_code', :with => 'NPR'  
14 - fill_in 'project_path', :with => 'newproject'  
15 - click_button "Create project"  
16 -end  
17 -  
18 -Then /^I should see project page$/ do  
19 - current_path.should == project_path(Project.last)  
20 - page.should have_content('NewProject')  
21 -end  
22 -  
23 -Then /^I should see empty project instuctions$/ do  
24 - page.should have_content("git init")  
25 - page.should have_content("git remote")  
26 - page.should have_content(Project.last.url_to_repo)  
27 -end  
28 -  
29 -Given /^I own project "(.*?)"$/ do |arg1|  
30 - @project = Factory :project, :name => arg1  
31 - @project.add_access(@user, :admin)  
32 -end  
33 -  
34 -Given /^I visit project "(.*?)" wall page$/ do |arg1|  
35 - project = Project.find_by_name(arg1)  
36 - visit wall_project_path(project)  
37 -end  
38 -  
39 -Then /^I should see project wall note "(.*?)"$/ do |arg1|  
40 - page.should have_content arg1  
41 -end  
42 -  
43 -Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2|  
44 - project = Project.find_by_name(arg1)  
45 - project.notes.create(:note => arg1, :author => project.users.first)  
46 -end  
47 -  
48 -Given /^I write new comment "(.*?)"$/ do |arg1|  
49 - fill_in "note_note", :with => arg1  
50 - click_button "Add Comment"  
51 -end  
52 -  
53 -Given /^I visit project "(.*?)" network page$/ do |arg1|  
54 - project = Project.find_by_name(arg1)  
55 - visit graph_project_path(project)  
56 -end  
57 -  
58 -Given /^show me page$/ do  
59 - save_and_open_page  
60 -end  
61 -  
62 -Given /^page should have network graph$/ do  
63 - page.should have_content "Project Network Graph"  
64 - within ".graph" do  
65 - page.should have_content "stable"  
66 - page.should have_content "notes_refacto..."  
67 - end  
68 -end  
spec/requests/atom/issues_spec.rb 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +require 'spec_helper'
  2 +
  3 +describe "Issues" do
  4 + let(:project) { Factory :project }
  5 +
  6 + before do
  7 + login_as :user
  8 + project.add_access(@user, :read, :write)
  9 + end
  10 +
  11 + describe "GET /issues" do
  12 + before do
  13 + @issue = Factory :issue,
  14 + :author => @user,
  15 + :assignee => @user,
  16 + :project => project
  17 +
  18 + visit project_issues_path(project)
  19 + end
  20 +
  21 + it "should render atom feed" do
  22 + visit project_issues_path(project, :atom)
  23 +
  24 + page.response_headers['Content-Type'].should have_content("application/atom+xml")
  25 + page.body.should have_selector("title", :text => "#{project.name} issues")
  26 + page.body.should have_selector("author email", :text => @issue.author_email)
  27 + page.body.should have_selector("entry summary", :text => @issue.title)
  28 + end
  29 +
  30 + it "should render atom feed via private token" do
  31 + logout
  32 + visit project_issues_path(project, :atom, :private_token => @user.private_token)
  33 +
  34 + page.response_headers['Content-Type'].should have_content("application/atom+xml")
  35 + page.body.should have_selector("title", :text => "#{project.name} issues")
  36 + page.body.should have_selector("author email", :text => @issue.author_email)
  37 + page.body.should have_selector("entry summary", :text => @issue.title)
  38 + end
  39 + end
  40 +end
spec/requests/issues_notes_spec.rb
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -require 'spec_helper'  
2 -  
3 -describe "Issues" do  
4 - let(:project) { Factory :project }  
5 -  
6 - before do  
7 - login_as :user  
8 - project.add_access(@user, :read, :write)  
9 -  
10 - @issue = Factory :issue,  
11 - :author => @user,  
12 - :assignee => @user,  
13 - :project => project  
14 - end  
15 -  
16 - describe "add new note", :js => true do  
17 - before do  
18 - visit project_issue_path(project, @issue)  
19 - fill_in "note_note", :with => "I commented this issue"  
20 - click_button "Add Comment"  
21 - end  
22 -  
23 - it "should conatin new note" do  
24 - page.should have_content("I commented this issue")  
25 - end  
26 - end  
27 -end  
spec/requests/issues_spec.rb
@@ -11,161 +11,6 @@ describe "Issues" do @@ -11,161 +11,6 @@ describe "Issues" do
11 project.add_access(@user2, :read, :write) 11 project.add_access(@user2, :read, :write)
12 end 12 end
13 13
14 - describe "GET /issues" do  
15 - before do  
16 - @issue = Factory :issue,  
17 - :author => @user,  
18 - :assignee => @user,  
19 - :project => project  
20 -  
21 - visit project_issues_path(project)  
22 - end  
23 -  
24 - subject { page }  
25 -  
26 - it { should have_content(@issue.title[0..20]) }  
27 - it { should have_content(@issue.project.name) }  
28 - it { should have_content(@issue.assignee.name) }  
29 -  
30 - it "should render atom feed" do  
31 - visit project_issues_path(project, :atom)  
32 -  
33 - page.response_headers['Content-Type'].should have_content("application/atom+xml")  
34 - page.body.should have_selector("title", :text => "#{project.name} issues")  
35 - page.body.should have_selector("author email", :text => @issue.author_email)  
36 - page.body.should have_selector("entry summary", :text => @issue.title)  
37 - end  
38 -  
39 - it "should render atom feed via private token" do  
40 - logout  
41 - visit project_issues_path(project, :atom, :private_token => @user.private_token)  
42 -  
43 - page.response_headers['Content-Type'].should have_content("application/atom+xml")  
44 - page.body.should have_selector("title", :text => "#{project.name} issues")  
45 - page.body.should have_selector("author email", :text => @issue.author_email)  
46 - page.body.should have_selector("entry summary", :text => @issue.title)  
47 - end  
48 -  
49 - describe "statuses" do  
50 - before do  
51 - @closed_issue = Factory :issue,  
52 - :author => @user,  
53 - :assignee => @user,  
54 - :project => project,  
55 - :closed => true  
56 - end  
57 -  
58 - it "should show only open" do  
59 - should have_content(@issue.title[0..25])  
60 - should have_no_content(@closed_issue.title)  
61 - end  
62 -  
63 - it "should show only closed" do  
64 - click_link "Closed"  
65 - should have_no_content(@issue.title)  
66 - should have_content(@closed_issue.title[0..25])  
67 - end  
68 -  
69 - it "should show all" do  
70 - click_link "All"  
71 - should have_content(@issue.title[0..25])  
72 - should have_content(@closed_issue.title[0..25])  
73 - end  
74 - end  
75 - end  
76 -  
77 - describe "New issue", :js => true do  
78 - before do  
79 - visit project_issues_path(project)  
80 - click_link "New Issue"  
81 - end  
82 -  
83 - it "should open new issue form" do  
84 - page.should have_content("New Issue")  
85 - end  
86 -  
87 - describe "fill in" do  
88 - describe 'assign to me' do  
89 - before do  
90 - fill_in "issue_title", :with => "bug 345"  
91 - page.execute_script("$('#issue_assignee_id').show();")  
92 - select @user.name, :from => "issue_assignee_id"  
93 - end  
94 -  
95 - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) }  
96 -  
97 - it "should add new issue to table" do  
98 - click_button "Submit new issue"  
99 -  
100 - page.should_not have_content("Add new issue")  
101 - page.should have_content @user.name  
102 - page.should have_content "bug 345"  
103 - page.should have_content project.name  
104 - end  
105 -  
106 - it "should call send mail" do  
107 - Notify.should_not_receive(:new_issue_email)  
108 - click_button "Submit new issue"  
109 - end  
110 - end  
111 -  
112 - describe 'assign to other' do  
113 - before do  
114 - fill_in "issue_title", :with => "bug 345"  
115 - page.execute_script("$('#issue_assignee_id').show();")  
116 - select @user2.name, :from => "issue_assignee_id"  
117 - end  
118 -  
119 - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) }  
120 -  
121 - it "should add new issue to table" do  
122 - click_button "Submit new issue"  
123 -  
124 - page.should_not have_content("Add new issue")  
125 - page.should have_content @user2.name  
126 - page.should have_content "bug 345"  
127 - page.should have_content project.name  
128 - end  
129 -  
130 - it "should call send mail" do  
131 - Issue.observers.enable :issue_observer do  
132 - Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))  
133 - click_button "Submit new issue"  
134 - end  
135 - end  
136 -  
137 - it "should send valid email to user" do  
138 - Issue.observers.enable :issue_observer do  
139 - with_resque do  
140 - click_button "Submit new issue"  
141 - end  
142 - issue = Issue.last  
143 - email = ActionMailer::Base.deliveries.last  
144 - email.subject.should have_content("New Issue was created")  
145 - email.body.should have_content(issue.title)  
146 - end  
147 - end  
148 -  
149 - end  
150 - end  
151 - end  
152 -  
153 - describe "Show issue" do  
154 - before do  
155 - @issue = Factory :issue,  
156 - :author => @user,  
157 - :assignee => @user,  
158 - :project => project  
159 -  
160 - visit project_issue_path(project, @issue)  
161 - end  
162 -  
163 - it "should have valid show page for issue" do  
164 - page.should have_content @issue.title  
165 - page.should have_content @user.name  
166 - end  
167 - end  
168 -  
169 describe "Edit issue", :js => true do 14 describe "Edit issue", :js => true do
170 before do 15 before do
171 @issue = Factory :issue, 16 @issue = Factory :issue,