diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-24 19:04:57 +0200 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-24 19:04:57 +0200 |
| commit | b1970e0cf1271a8263a7ccf6b2aa8abb7ae59b2d (patch) | |
| tree | e0f04edf4d90dab1266b8c389bd2c8f3e3cea271 /features/steps/dashboard | |
| parent | 4c61c467385ca889bc273a171bcd1ebfb9e739e9 (diff) | |
| download | gitlab-ce-b1970e0cf1271a8263a7ccf6b2aa8abb7ae59b2d.tar.gz | |
Tests for Dashboard#issues filter
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'features/steps/dashboard')
| -rw-r--r-- | features/steps/dashboard/dashboard_issues.rb | 74 |
1 files changed, 64 insertions, 10 deletions
diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb index fcf4296ad11..47d83f73ed2 100644 --- a/features/steps/dashboard/dashboard_issues.rb +++ b/features/steps/dashboard/dashboard_issues.rb @@ -2,19 +2,73 @@ class DashboardIssues < Spinach::FeatureSteps include SharedAuthentication include SharedPaths - 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) - page.should have_link(issue.project.name) + step 'I should see issues assigned to me' do + should_see(assigned_issue) + should_not_see(authored_issue) + should_not_see(other_issue) + end + + step 'I should see issues authored by me' do + should_see(authored_issue) + should_not_see(assigned_issue) + should_not_see(other_issue) + end + + step 'I should see all issues' do + should_see(authored_issue) + should_see(assigned_issue) + should_see(other_issue) + end + + step 'I have authored issues' do + authored_issue + end + + step 'I have assigned issues' do + assigned_issue + end + + step 'I have other issues' do + other_issue + end + + step 'I click "Authored by me" link' do + within ".scope-filter" do + click_link 'Authored by me' end end - And 'I have assigned issues' do - project = create :project - project.team << [@user, :master] + step 'I click "All" link' do + within ".scope-filter" do + click_link 'All' + end + end + + def should_see(issue) + page.should have_content(issue.title[0..10]) + end + + def should_not_see(issue) + page.should_not have_content(issue.title[0..10]) + end + + def assigned_issue + @assigned_issue ||= create :issue, assignee: current_user, project: project + end + + def authored_issue + @authored_issue ||= create :issue, author: current_user, project: project + end + + def other_issue + @other_issue ||= create :issue, project: project + end - 2.times { create :issue, author: @user, assignee: @user, project: project } + def project + @project ||= begin + project =create :project_with_code + project.team << [current_user, :master] + project + end end end |
