Issues cucumber. refactored step_definitoons

This commit is contained in:
Dmitriy Zaporozhets 2012-08-03 19:49:54 +03:00
parent b846ac1059
commit 1281c122c7
14 changed files with 115 additions and 206 deletions

View file

@ -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"

View file

@ -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

View file

@ -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