Better cucumber coverage for dashboard

This commit is contained in:
randx 2012-07-29 20:22:48 +03:00
parent 2cf5a9efbc
commit 217810433b
3 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,8 @@
Feature: Dashboard Issues
Background:
Given I signin as a user
And I have assigned issues
And I visit dashboard issues page
Scenario: I should see issues list
Then I should see issues assigned to me

View file

@ -0,0 +1,8 @@
Feature: Dashboard MR
Background:
Given I signin as a user
And I have authored merge requests
And I visit dashboard merge requests page
Scenario: I should see projects list
Then I should see my merge requests

View file

@ -65,3 +65,71 @@ Given /^I search for "(.*?)"$/ do |arg1|
fill_in "dashboard_search", :with => arg1
click_button "Search"
end
Given /^I visit dashboard issues page$/ do
visit dashboard_issues_path
end
Then /^I should see issues assigned to me$/ do
issues = @user.issues
issues.each do |issue|
page.should have_content(issue.title[0..10])
page.should have_content(issue.project.name)
end
end
Given /^I visit dashboard merge requests page$/ do
visit dashboard_merge_requests_path
end
Then /^I should see my merge requests$/ do
merge_requests = @user.merge_requests
merge_requests.each do |mr|
page.should have_content(mr.title[0..10])
page.should have_content(mr.project.name)
end
end
Given /^I have assigned issues$/ do
project1 = Factory :project,
:path => "project1",
:code => "TEST1"
project2 = Factory :project,
:path => "project2",
:code => "TEST2"
project1.add_access(@user, :read, :write)
project2.add_access(@user, :read, :write)
issue1 = Factory :issue,
:author => @user,
:assignee => @user,
:project => project1
issue2 = Factory :issue,
:author => @user,
:assignee => @user,
:project => project2
end
Given /^I have authored merge requests$/ do
project1 = Factory :project,
:path => "project1",
:code => "TEST1"
project2 = Factory :project,
:path => "project2",
:code => "TEST2"
project1.add_access(@user, :read, :write)
project2.add_access(@user, :read, :write)
merge_request1 = Factory :merge_request,
:author => @user,
:project => project1
merge_request2 = Factory :merge_request,
:author => @user,
:project => project2
end