diff --git a/features/projects/issues/issues.feature b/features/projects/issues/issues.feature index 0ca0792..a45dd80 100644 --- a/features/projects/issues/issues.feature +++ b/features/projects/issues/issues.feature @@ -7,6 +7,32 @@ Feature: Issues And I visit project "Shop" issues page Scenario: I should see open issues - Given I should see "Release 0.4" open issue - And I should not see "Release 0.3" closed issue + Given I should see "Release 0.4" in issues + And I should not see "Release 0.3" in issues + Scenario: I should see closed issues + Given I click link "Closed" + Then I should see "Release 0.3" in issues + And I should not see "Release 0.4" in issues + + Scenario: I should see all issues + Given I click link "All" + Then I should see "Release 0.3" in issues + And I should see "Release 0.4" in issues + + Scenario: I visit issue page + Given I click link "Release 0.4" + Then I should see issue "Release 0.4" + + @javascript + Scenario: I submit new unassigned issue + Given I click link "New Issue" + And I submit new issue "500 error on profile" + Given I click link "500 error on profile" + Then I should see issue "500 error on profile" + + @javascript + Scenario: I comment issue + Given I visit issue page "Release 0.4" + And I leave a comment like "XML attached" + Then I should see commetn "XML attached" diff --git a/features/step_definitions/browse_code_steps.rb b/features/step_definitions/browse_code_steps.rb deleted file mode 100644 index 7f9001b..0000000 --- a/features/step_definitions/browse_code_steps.rb +++ /dev/null @@ -1,50 +0,0 @@ -Given /^I visit project source page$/ do - visit tree_project_ref_path(@project, @project.root_ref) -end - -Then /^I should see files from repository$/ do - page.should have_content("app") - page.should have_content("History") - page.should have_content("Gemfile") -end - -Given /^I visit project source page for "(.*?)"$/ do |arg1| - visit tree_project_ref_path(@project, arg1) -end - -Then /^I should see files from repository for "(.*?)"$/ do |arg1| - current_path.should == tree_project_ref_path(@project, arg1) - page.should have_content("app") - page.should have_content("History") - page.should have_content("Gemfile") -end - -Given /^I click on file from repo$/ do - click_link "Gemfile" -end - -Then /^I should see it content$/ do - page.should have_content("rubygems.org") -end - -Given /^I click on raw button$/ do - click_link "raw" -end - -Given /^I visit blob file from repo$/ do - visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) -end - -Then /^I should see raw file content$/ do - page.source.should == ValidCommit::BLOB_FILE -end - -Given /^I click blame button$/ do - click_link "blame" -end - -Then /^I should see git file blame$/ do - page.should have_content("rubygems.org") - page.should have_content("Dmitriy Zaporozhets") - page.should have_content("bc3735004cb Moving to rails 3.2") -end diff --git a/features/step_definitions/profile/profile_keys_steps.rb b/features/step_definitions/profile/profile_keys_steps.rb new file mode 100644 index 0000000..5ab7e04 --- /dev/null +++ b/features/step_definitions/profile/profile_keys_steps.rb @@ -0,0 +1,34 @@ +Given /^I visit profile keys page$/ do + visit keys_path +end + +Then /^I should see my ssh keys$/ do + @user.keys.each do |key| + page.should have_content(key.title) + end +end + +Given /^I have ssh keys:$/ do |table| + table.hashes.each do |row| + Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}" + end +end + +Given /^I submit new ssh key "(.*?)"$/ do |arg1| + fill_in "key_title", :with => arg1 + fill_in "key_key", :with => "publickey234=" + click_button "Save" +end + +Then /^I should see new ssh key "(.*?)"$/ do |arg1| + key = Key.find_by_title(arg1) + page.should have_content(key.title) + page.should have_content(key.key) + current_path.should == key_path(key) +end + +Then /^I should not see "(.*?)" ssh key$/ do |arg1| + within "#keys-table" do + page.should_not have_content(arg1) + end +end diff --git a/features/step_definitions/profile/profile_steps.rb b/features/step_definitions/profile/profile_steps.rb new file mode 100644 index 0000000..4661139 --- /dev/null +++ b/features/step_definitions/profile/profile_steps.rb @@ -0,0 +1,51 @@ +Given /^I visit profile page$/ do + visit profile_path +end + +Then /^I should see my profile info$/ do + page.should have_content "Profile" + page.should have_content @user.name + page.should have_content @user.email +end + +Given /^I visit profile password page$/ do + visit profile_password_path +end + +Then /^I change my password$/ do + fill_in "user_password", :with => "222333" + fill_in "user_password_confirmation", :with => "222333" + click_button "Save" +end + +Then /^I should be redirected to sign in page$/ do + current_path.should == new_user_session_path +end + +Given /^I visit profile token page$/ do + visit profile_token_path +end + +Then /^I reset my token$/ do + @old_token = @user.private_token + click_button "Reset" +end + +Then /^I should see new token$/ do + find("#token").value.should_not == @old_token + find("#token").value.should == @user.reload.private_token +end + +Then /^I change my contact info$/ do + fill_in "user_skype", :with => "testskype" + fill_in "user_linkedin", :with => "testlinkedin" + fill_in "user_twitter", :with => "testtwitter" + click_button "Save" + @user.reload +end + +Then /^I should see new contact info$/ do + @user.skype.should == 'testskype' + @user.linkedin.should == 'testlinkedin' + @user.twitter.should == 'testtwitter' +end diff --git a/features/step_definitions/profile_keys_steps.rb b/features/step_definitions/profile_keys_steps.rb deleted file mode 100644 index 5ab7e04..0000000 --- a/features/step_definitions/profile_keys_steps.rb +++ /dev/null @@ -1,34 +0,0 @@ -Given /^I visit profile keys page$/ do - visit keys_path -end - -Then /^I should see my ssh keys$/ do - @user.keys.each do |key| - page.should have_content(key.title) - end -end - -Given /^I have ssh keys:$/ do |table| - table.hashes.each do |row| - Factory :key, :user => @user, :title => row[:title], :key => "jfKLJDFKSFJSHFJ#{row[:title]}" - end -end - -Given /^I submit new ssh key "(.*?)"$/ do |arg1| - fill_in "key_title", :with => arg1 - fill_in "key_key", :with => "publickey234=" - click_button "Save" -end - -Then /^I should see new ssh key "(.*?)"$/ do |arg1| - key = Key.find_by_title(arg1) - page.should have_content(key.title) - page.should have_content(key.key) - current_path.should == key_path(key) -end - -Then /^I should not see "(.*?)" ssh key$/ do |arg1| - within "#keys-table" do - page.should_not have_content(arg1) - end -end diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile_steps.rb deleted file mode 100644 index 4661139..0000000 --- a/features/step_definitions/profile_steps.rb +++ /dev/null @@ -1,51 +0,0 @@ -Given /^I visit profile page$/ do - visit profile_path -end - -Then /^I should see my profile info$/ do - page.should have_content "Profile" - page.should have_content @user.name - page.should have_content @user.email -end - -Given /^I visit profile password page$/ do - visit profile_password_path -end - -Then /^I change my password$/ do - fill_in "user_password", :with => "222333" - fill_in "user_password_confirmation", :with => "222333" - click_button "Save" -end - -Then /^I should be redirected to sign in page$/ do - current_path.should == new_user_session_path -end - -Given /^I visit profile token page$/ do - visit profile_token_path -end - -Then /^I reset my token$/ do - @old_token = @user.private_token - click_button "Reset" -end - -Then /^I should see new token$/ do - find("#token").value.should_not == @old_token - find("#token").value.should == @user.reload.private_token -end - -Then /^I change my contact info$/ do - fill_in "user_skype", :with => "testskype" - fill_in "user_linkedin", :with => "testlinkedin" - fill_in "user_twitter", :with => "testtwitter" - click_button "Save" - @user.reload -end - -Then /^I should see new contact info$/ do - @user.skype.should == 'testskype' - @user.linkedin.should == 'testlinkedin' - @user.twitter.should == 'testtwitter' -end diff --git a/features/step_definitions/project/browse_code_steps.rb b/features/step_definitions/project/browse_code_steps.rb new file mode 100644 index 0000000..7f9001b --- /dev/null +++ b/features/step_definitions/project/browse_code_steps.rb @@ -0,0 +1,50 @@ +Given /^I visit project source page$/ do + visit tree_project_ref_path(@project, @project.root_ref) +end + +Then /^I should see files from repository$/ do + page.should have_content("app") + page.should have_content("History") + page.should have_content("Gemfile") +end + +Given /^I visit project source page for "(.*?)"$/ do |arg1| + visit tree_project_ref_path(@project, arg1) +end + +Then /^I should see files from repository for "(.*?)"$/ do |arg1| + current_path.should == tree_project_ref_path(@project, arg1) + page.should have_content("app") + page.should have_content("History") + page.should have_content("Gemfile") +end + +Given /^I click on file from repo$/ do + click_link "Gemfile" +end + +Then /^I should see it content$/ do + page.should have_content("rubygems.org") +end + +Given /^I click on raw button$/ do + click_link "raw" +end + +Given /^I visit blob file from repo$/ do + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) +end + +Then /^I should see raw file content$/ do + page.source.should == ValidCommit::BLOB_FILE +end + +Given /^I click blame button$/ do + click_link "blame" +end + +Then /^I should see git file blame$/ do + page.should have_content("rubygems.org") + page.should have_content("Dmitriy Zaporozhets") + page.should have_content("bc3735004cb Moving to rails 3.2") +end diff --git a/features/step_definitions/project/project_commits_steps.rb b/features/step_definitions/project/project_commits_steps.rb new file mode 100644 index 0000000..9b3b0aa --- /dev/null +++ b/features/step_definitions/project/project_commits_steps.rb @@ -0,0 +1,61 @@ +Given /^I visit project commits page$/ do + visit project_commits_path(@project) +end + +Then /^I see project commits$/ do + current_path.should == project_commits_path(@project) + + commit = @project.commit + page.should have_content(@project.name) + page.should have_content(commit.message) + page.should have_content(commit.id.to_s[0..5]) +end + +Given /^I click atom feed link$/ do + click_link "Feed" +end + +Then /^I see commits atom feed$/ do + commit = CommitDecorator.decorate(@project.commit) + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") + page.body.should have_selector("author email", :text => commit.author_email) + page.body.should have_selector("entry summary", :text => commit.description) +end + +Given /^I click on commit link$/ do + visit project_commit_path(@project, ValidCommit::ID) +end + +Then /^I see commit info$/ do + page.should have_content ValidCommit::MESSAGE + page.should have_content "Showing 1 changed file" +end + +Given /^I visit compare refs page$/ do + visit compare_project_commits_path(@project) +end + +Given /^I fill compare fields with refs$/ do + fill_in "from", :with => "master" + fill_in "to", :with => "stable" + click_button "Compare" +end + +Given /^I see compared refs$/ do + page.should have_content "Commits (27)" + page.should have_content "Compare View" + page.should have_content "Showing 73 changed files" +end + +Given /^I visit project branches page$/ do + visit branches_project_repository_path(@project) +end + +Given /^I visit project commit page$/ do + visit project_commit_path(@project, ValidCommit::ID) +end + +Given /^I visit project tags page$/ do + visit tags_project_repository_path(@project) +end diff --git a/features/step_definitions/project/project_issues_steps.rb b/features/step_definitions/project/project_issues_steps.rb new file mode 100644 index 0000000..2c47f37 --- /dev/null +++ b/features/step_definitions/project/project_issues_steps.rb @@ -0,0 +1,47 @@ +Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first) +end + +Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) +end + +Given /^I visit project "(.*?)" issues page$/ do |arg1| + visit project_issues_path(Project.find_by_name(arg1)) +end + +Given /^I should see "(.*?)" in issues$/ do |arg1| + page.should have_content arg1 +end + +Given /^I should not see "(.*?)" in issues$/ do |arg1| + page.should_not have_content arg1 +end + +Then /^I should see issue "(.*?)"$/ do |arg1| + issue = Issue.find_by_title(arg1) + page.should have_content issue.title + page.should have_content issue.author_name + page.should have_content issue.project.name +end + +Given /^I visit issue page "(.*?)"$/ do |arg1| + issue = Issue.find_by_title(arg1) + visit project_issue_path(issue.project, issue) +end + +Given /^I leave a comment like "(.*?)"$/ do |arg1| + fill_in "note_note", :with => arg1 + click_button "Add Comment" +end + +Then /^I should see commetn "(.*?)"$/ do |arg1| + page.should have_content(arg1) +end + +Given /^I submit new issue "(.*?)"$/ do |arg1| + fill_in "issue_title", :with => arg1 + click_button "Submit new issue" +end diff --git a/features/step_definitions/project/project_merge_requests_steps.rb b/features/step_definitions/project/project_merge_requests_steps.rb new file mode 100644 index 0000000..6749773 --- /dev/null +++ b/features/step_definitions/project/project_merge_requests_steps.rb @@ -0,0 +1,38 @@ +Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + + milestone = Factory :milestone, + :title => arg2, + :project => project + + 3.times do |i| + issue = Factory :issue, + :project => project, + :milestone => milestone + end +end + +Given /^I visit project "(.*?)" milestones page$/ do |arg1| + @project = Project.find_by_name(arg1) + visit project_milestones_path(@project) +end + +Then /^I should see active milestones$/ do + milestone = @project.milestones.first + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") +end + +Then /^I should see milestone "(.*?)"$/ do |arg1| + milestone = @project.milestones.find_by_title(arg1) + page.should have_content(milestone.title[0..10]) + page.should have_content(milestone.expires_at) + page.should have_content("Browse Issues") +end + +Given /^I submit new milestone "(.*?)"$/ do |arg1| + fill_in "milestone_title", :with => arg1 + click_button "Create milestone" +end + diff --git a/features/step_definitions/project/project_team_steps.rb b/features/step_definitions/project/project_team_steps.rb new file mode 100644 index 0000000..f0bab29 --- /dev/null +++ b/features/step_definitions/project/project_team_steps.rb @@ -0,0 +1,63 @@ +Given /^gitlab user "(.*?)"$/ do |arg1| + Factory :user, :name => arg1 +end + +Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2| + user = User.find_by_name(arg1) + project = Project.find_by_name(arg2) + project.add_access(user, :write) +end + +Given /^I visit project "(.*?)" team page$/ do |arg1| + visit team_project_path(Project.find_by_name(arg1)) +end + +Then /^I should be able to see myself in team$/ do + page.should have_content(@user.name) + page.should have_content(@user.email) +end + +Then /^I should see "(.*?)" in team list$/ do |arg1| + user = User.find_by_name(arg1) + page.should have_content(user.name) + page.should have_content(user.email) +end + +Given /^I click link "(.*?)"$/ do |arg1| + click_link arg1 +end + +Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| + user = User.find_by_name(arg1) + within "#new_team_member" do + select user.name, :from => "team_member_user_id" + select arg2, :from => "team_member_project_access" + end + click_button "Save" +end + +Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2| + user = User.find_by_name(arg1) + role_id = find(".user_#{user.id} #team_member_project_access").value + role_id.should == UsersProject.access_roles[arg2].to_s +end + +Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2| + user = User.find_by_name(arg1) + within ".user_#{user.id}" do + select arg2, :from => "team_member_project_access" + end +end + +Then /^I should see "(.*?)" team profile$/ do |arg1| + user = User.find_by_name(arg1) + page.should have_content(user.name) + page.should have_content(user.email) + page.should have_content("To team list") +end + +Then /^I should not see "(.*?)" in team list$/ do |arg1| + user = User.find_by_name(arg1) + page.should_not have_content(user.name) + page.should_not have_content(user.email) +end diff --git a/features/step_definitions/project/project_wiki_steps.rb b/features/step_definitions/project/project_wiki_steps.rb new file mode 100644 index 0000000..10de38d --- /dev/null +++ b/features/step_definitions/project/project_wiki_steps.rb @@ -0,0 +1,18 @@ +Given /^I visit project wiki page$/ do + visit project_wiki_path(@project, :index) +end + +Given /^I create Wiki page$/ do + fill_in "Title", :with => 'Test title' + fill_in "Content", :with => '[link test](test)' + click_on "Save" +end + +Then /^I should see newly created wiki page$/ do + page.should have_content("Test title") + page.should have_content("link test") + + click_link "link test" + + page.should have_content("Editing page") +end diff --git a/features/step_definitions/project/projects_steps.rb b/features/step_definitions/project/projects_steps.rb new file mode 100644 index 0000000..bca1213 --- /dev/null +++ b/features/step_definitions/project/projects_steps.rb @@ -0,0 +1,68 @@ +include LoginMacros + +Given /^I signin as a user$/ do + login_as :user +end + +When /^I visit new project page$/ do + visit new_project_path +end + +When /^fill project form with valid data$/ do + fill_in 'project_name', :with => 'NewProject' + fill_in 'project_code', :with => 'NPR' + fill_in 'project_path', :with => 'newproject' + click_button "Create project" +end + +Then /^I should see project page$/ do + current_path.should == project_path(Project.last) + page.should have_content('NewProject') +end + +Then /^I should see empty project instuctions$/ do + page.should have_content("git init") + page.should have_content("git remote") + page.should have_content(Project.last.url_to_repo) +end + +Given /^I own project "(.*?)"$/ do |arg1| + @project = Factory :project, :name => arg1 + @project.add_access(@user, :admin) +end + +Given /^I visit project "(.*?)" wall page$/ do |arg1| + project = Project.find_by_name(arg1) + visit wall_project_path(project) +end + +Then /^I should see project wall note "(.*?)"$/ do |arg1| + page.should have_content arg1 +end + +Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2| + project = Project.find_by_name(arg1) + project.notes.create(:note => arg1, :author => project.users.first) +end + +Given /^I write new comment "(.*?)"$/ do |arg1| + fill_in "note_note", :with => arg1 + click_button "Add Comment" +end + +Given /^I visit project "(.*?)" network page$/ do |arg1| + project = Project.find_by_name(arg1) + visit graph_project_path(project) +end + +Given /^show me page$/ do + save_and_open_page +end + +Given /^page should have network graph$/ do + page.should have_content "Project Network Graph" + within ".graph" do + page.should have_content "stable" + page.should have_content "notes_refacto..." + end +end diff --git a/features/step_definitions/project_commits_steps.rb b/features/step_definitions/project_commits_steps.rb deleted file mode 100644 index 9b3b0aa..0000000 --- a/features/step_definitions/project_commits_steps.rb +++ /dev/null @@ -1,61 +0,0 @@ -Given /^I visit project commits page$/ do - visit project_commits_path(@project) -end - -Then /^I see project commits$/ do - current_path.should == project_commits_path(@project) - - commit = @project.commit - page.should have_content(@project.name) - page.should have_content(commit.message) - page.should have_content(commit.id.to_s[0..5]) -end - -Given /^I click atom feed link$/ do - click_link "Feed" -end - -Then /^I see commits atom feed$/ do - commit = CommitDecorator.decorate(@project.commit) - page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") - page.body.should have_selector("author email", :text => commit.author_email) - page.body.should have_selector("entry summary", :text => commit.description) -end - -Given /^I click on commit link$/ do - visit project_commit_path(@project, ValidCommit::ID) -end - -Then /^I see commit info$/ do - page.should have_content ValidCommit::MESSAGE - page.should have_content "Showing 1 changed file" -end - -Given /^I visit compare refs page$/ do - visit compare_project_commits_path(@project) -end - -Given /^I fill compare fields with refs$/ do - fill_in "from", :with => "master" - fill_in "to", :with => "stable" - click_button "Compare" -end - -Given /^I see compared refs$/ do - page.should have_content "Commits (27)" - page.should have_content "Compare View" - page.should have_content "Showing 73 changed files" -end - -Given /^I visit project branches page$/ do - visit branches_project_repository_path(@project) -end - -Given /^I visit project commit page$/ do - visit project_commit_path(@project, ValidCommit::ID) -end - -Given /^I visit project tags page$/ do - visit tags_project_repository_path(@project) -end diff --git a/features/step_definitions/project_issues_steps.rb b/features/step_definitions/project_issues_steps.rb deleted file mode 100644 index e83c0e7..0000000 --- a/features/step_definitions/project_issues_steps.rb +++ /dev/null @@ -1,22 +0,0 @@ -Given /^project "(.*?)" have "(.*?)" open issue$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first) -end - -Given /^project "(.*?)" have "(.*?)" closed issue$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - Factory.create(:issue, :title => arg2, :project => project, :author => project.users.first, :closed => true) -end - -Given /^I visit project "(.*?)" issues page$/ do |arg1| - visit project_issues_path(Project.find_by_name(arg1)) -end - -Given /^I should see "(.*?)" open issue$/ do |arg1| - page.should have_content arg1 -end - -Given /^I should not see "(.*?)" closed issue$/ do |arg1| - page.should_not have_content arg1 -end - diff --git a/features/step_definitions/project_merge_requests_steps.rb b/features/step_definitions/project_merge_requests_steps.rb deleted file mode 100644 index 6749773..0000000 --- a/features/step_definitions/project_merge_requests_steps.rb +++ /dev/null @@ -1,38 +0,0 @@ -Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - - milestone = Factory :milestone, - :title => arg2, - :project => project - - 3.times do |i| - issue = Factory :issue, - :project => project, - :milestone => milestone - end -end - -Given /^I visit project "(.*?)" milestones page$/ do |arg1| - @project = Project.find_by_name(arg1) - visit project_milestones_path(@project) -end - -Then /^I should see active milestones$/ do - milestone = @project.milestones.first - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Browse Issues") -end - -Then /^I should see milestone "(.*?)"$/ do |arg1| - milestone = @project.milestones.find_by_title(arg1) - page.should have_content(milestone.title[0..10]) - page.should have_content(milestone.expires_at) - page.should have_content("Browse Issues") -end - -Given /^I submit new milestone "(.*?)"$/ do |arg1| - fill_in "milestone_title", :with => arg1 - click_button "Create milestone" -end - diff --git a/features/step_definitions/project_team_steps.rb b/features/step_definitions/project_team_steps.rb deleted file mode 100644 index f0bab29..0000000 --- a/features/step_definitions/project_team_steps.rb +++ /dev/null @@ -1,63 +0,0 @@ -Given /^gitlab user "(.*?)"$/ do |arg1| - Factory :user, :name => arg1 -end - -Given /^"(.*?)" is "(.*?)" developer$/ do |arg1, arg2| - user = User.find_by_name(arg1) - project = Project.find_by_name(arg2) - project.add_access(user, :write) -end - -Given /^I visit project "(.*?)" team page$/ do |arg1| - visit team_project_path(Project.find_by_name(arg1)) -end - -Then /^I should be able to see myself in team$/ do - page.should have_content(@user.name) - page.should have_content(@user.email) -end - -Then /^I should see "(.*?)" in team list$/ do |arg1| - user = User.find_by_name(arg1) - page.should have_content(user.name) - page.should have_content(user.email) -end - -Given /^I click link "(.*?)"$/ do |arg1| - click_link arg1 -end - -Given /^I select "(.*?)" as "(.*?)"$/ do |arg1, arg2| - user = User.find_by_name(arg1) - within "#new_team_member" do - select user.name, :from => "team_member_user_id" - select arg2, :from => "team_member_project_access" - end - click_button "Save" -end - -Then /^I should see "(.*?)" in team list as "(.*?)"$/ do |arg1, arg2| - user = User.find_by_name(arg1) - role_id = find(".user_#{user.id} #team_member_project_access").value - role_id.should == UsersProject.access_roles[arg2].to_s -end - -Given /^I change "(.*?)" role to "(.*?)"$/ do |arg1, arg2| - user = User.find_by_name(arg1) - within ".user_#{user.id}" do - select arg2, :from => "team_member_project_access" - end -end - -Then /^I should see "(.*?)" team profile$/ do |arg1| - user = User.find_by_name(arg1) - page.should have_content(user.name) - page.should have_content(user.email) - page.should have_content("To team list") -end - -Then /^I should not see "(.*?)" in team list$/ do |arg1| - user = User.find_by_name(arg1) - page.should_not have_content(user.name) - page.should_not have_content(user.email) -end diff --git a/features/step_definitions/project_wiki_steps.rb b/features/step_definitions/project_wiki_steps.rb deleted file mode 100644 index 10de38d..0000000 --- a/features/step_definitions/project_wiki_steps.rb +++ /dev/null @@ -1,18 +0,0 @@ -Given /^I visit project wiki page$/ do - visit project_wiki_path(@project, :index) -end - -Given /^I create Wiki page$/ do - fill_in "Title", :with => 'Test title' - fill_in "Content", :with => '[link test](test)' - click_on "Save" -end - -Then /^I should see newly created wiki page$/ do - page.should have_content("Test title") - page.should have_content("link test") - - click_link "link test" - - page.should have_content("Editing page") -end diff --git a/features/step_definitions/projects_steps.rb b/features/step_definitions/projects_steps.rb deleted file mode 100644 index bca1213..0000000 --- a/features/step_definitions/projects_steps.rb +++ /dev/null @@ -1,68 +0,0 @@ -include LoginMacros - -Given /^I signin as a user$/ do - login_as :user -end - -When /^I visit new project page$/ do - visit new_project_path -end - -When /^fill project form with valid data$/ do - fill_in 'project_name', :with => 'NewProject' - fill_in 'project_code', :with => 'NPR' - fill_in 'project_path', :with => 'newproject' - click_button "Create project" -end - -Then /^I should see project page$/ do - current_path.should == project_path(Project.last) - page.should have_content('NewProject') -end - -Then /^I should see empty project instuctions$/ do - page.should have_content("git init") - page.should have_content("git remote") - page.should have_content(Project.last.url_to_repo) -end - -Given /^I own project "(.*?)"$/ do |arg1| - @project = Factory :project, :name => arg1 - @project.add_access(@user, :admin) -end - -Given /^I visit project "(.*?)" wall page$/ do |arg1| - project = Project.find_by_name(arg1) - visit wall_project_path(project) -end - -Then /^I should see project wall note "(.*?)"$/ do |arg1| - page.should have_content arg1 -end - -Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2| - project = Project.find_by_name(arg1) - project.notes.create(:note => arg1, :author => project.users.first) -end - -Given /^I write new comment "(.*?)"$/ do |arg1| - fill_in "note_note", :with => arg1 - click_button "Add Comment" -end - -Given /^I visit project "(.*?)" network page$/ do |arg1| - project = Project.find_by_name(arg1) - visit graph_project_path(project) -end - -Given /^show me page$/ do - save_and_open_page -end - -Given /^page should have network graph$/ do - page.should have_content "Project Network Graph" - within ".graph" do - page.should have_content "stable" - page.should have_content "notes_refacto..." - end -end diff --git a/spec/requests/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb new file mode 100644 index 0000000..8d0b6c4 --- /dev/null +++ b/spec/requests/atom/issues_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe "Issues" do + let(:project) { Factory :project } + + before do + login_as :user + project.add_access(@user, :read, :write) + end + + describe "GET /issues" do + before do + @issue = Factory :issue, + :author => @user, + :assignee => @user, + :project => project + + visit project_issues_path(project) + end + + it "should render atom feed" do + visit project_issues_path(project, :atom) + + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", :text => "#{project.name} issues") + page.body.should have_selector("author email", :text => @issue.author_email) + page.body.should have_selector("entry summary", :text => @issue.title) + end + + it "should render atom feed via private token" do + logout + visit project_issues_path(project, :atom, :private_token => @user.private_token) + + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", :text => "#{project.name} issues") + page.body.should have_selector("author email", :text => @issue.author_email) + page.body.should have_selector("entry summary", :text => @issue.title) + end + end +end diff --git a/spec/requests/issues_notes_spec.rb b/spec/requests/issues_notes_spec.rb deleted file mode 100644 index 538098e..0000000 --- a/spec/requests/issues_notes_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'spec_helper' - -describe "Issues" do - let(:project) { Factory :project } - - before do - login_as :user - project.add_access(@user, :read, :write) - - @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project - end - - describe "add new note", :js => true do - before do - visit project_issue_path(project, @issue) - fill_in "note_note", :with => "I commented this issue" - click_button "Add Comment" - end - - it "should conatin new note" do - page.should have_content("I commented this issue") - end - end -end diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index 2c8650a..ad7b043 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -11,161 +11,6 @@ describe "Issues" do project.add_access(@user2, :read, :write) end - describe "GET /issues" do - before do - @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project - - visit project_issues_path(project) - end - - subject { page } - - it { should have_content(@issue.title[0..20]) } - it { should have_content(@issue.project.name) } - it { should have_content(@issue.assignee.name) } - - it "should render atom feed" do - visit project_issues_path(project, :atom) - - page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) - end - - it "should render atom feed via private token" do - logout - visit project_issues_path(project, :atom, :private_token => @user.private_token) - - page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) - end - - describe "statuses" do - before do - @closed_issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project, - :closed => true - end - - it "should show only open" do - should have_content(@issue.title[0..25]) - should have_no_content(@closed_issue.title) - end - - it "should show only closed" do - click_link "Closed" - should have_no_content(@issue.title) - should have_content(@closed_issue.title[0..25]) - end - - it "should show all" do - click_link "All" - should have_content(@issue.title[0..25]) - should have_content(@closed_issue.title[0..25]) - end - end - end - - describe "New issue", :js => true do - before do - visit project_issues_path(project) - click_link "New Issue" - end - - it "should open new issue form" do - page.should have_content("New Issue") - end - - describe "fill in" do - describe 'assign to me' do - before do - fill_in "issue_title", :with => "bug 345" - page.execute_script("$('#issue_assignee_id').show();") - select @user.name, :from => "issue_assignee_id" - end - - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) } - - it "should add new issue to table" do - click_button "Submit new issue" - - page.should_not have_content("Add new issue") - page.should have_content @user.name - page.should have_content "bug 345" - page.should have_content project.name - end - - it "should call send mail" do - Notify.should_not_receive(:new_issue_email) - click_button "Submit new issue" - end - end - - describe 'assign to other' do - before do - fill_in "issue_title", :with => "bug 345" - page.execute_script("$('#issue_assignee_id').show();") - select @user2.name, :from => "issue_assignee_id" - end - - it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) } - - it "should add new issue to table" do - click_button "Submit new issue" - - page.should_not have_content("Add new issue") - page.should have_content @user2.name - page.should have_content "bug 345" - page.should have_content project.name - end - - it "should call send mail" do - Issue.observers.enable :issue_observer do - Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true)) - click_button "Submit new issue" - end - end - - it "should send valid email to user" do - Issue.observers.enable :issue_observer do - with_resque do - click_button "Submit new issue" - end - issue = Issue.last - email = ActionMailer::Base.deliveries.last - email.subject.should have_content("New Issue was created") - email.body.should have_content(issue.title) - end - end - - end - end - end - - describe "Show issue" do - before do - @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project - - visit project_issue_path(project, @issue) - end - - it "should have valid show page for issue" do - page.should have_content @issue.title - page.should have_content @user.name - end - end - describe "Edit issue", :js => true do before do @issue = Factory :issue, -- libgit2 0.21.2