Commit b1970e0cf1271a8263a7ccf6b2aa8abb7ae59b2d
1 parent
4c61c467
Exists in
spb-stable
and in
3 other branches
Tests for Dashboard#issues filter
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
75 additions
and
11 deletions
Show diff stats
features/dashboard/issues.feature
1 | 1 | Feature: Dashboard Issues |
2 | 2 | Background: |
3 | 3 | Given I sign in as a user |
4 | + And I have authored issues | |
4 | 5 | And I have assigned issues |
6 | + And I have other issues | |
5 | 7 | And I visit dashboard issues page |
6 | 8 | |
7 | - Scenario: I should see issues list | |
9 | + Scenario: I should see assigned issues | |
8 | 10 | Then I should see issues assigned to me |
11 | + | |
12 | + Scenario: I should see authored issues | |
13 | + When I click "Authored by me" link | |
14 | + Then I should see issues authored by me | |
15 | + | |
16 | + Scenario: I should see all issues | |
17 | + When I click "All" link | |
18 | + Then I should see all issues | ... | ... |
features/steps/dashboard/dashboard_issues.rb
... | ... | @@ -2,19 +2,73 @@ class DashboardIssues < Spinach::FeatureSteps |
2 | 2 | include SharedAuthentication |
3 | 3 | include SharedPaths |
4 | 4 | |
5 | - Then 'I should see issues assigned to me' do | |
6 | - issues = @user.issues | |
7 | - issues.each do |issue| | |
8 | - page.should have_content(issue.title[0..10]) | |
9 | - page.should have_content(issue.project.name) | |
10 | - page.should have_link(issue.project.name) | |
5 | + step 'I should see issues assigned to me' do | |
6 | + should_see(assigned_issue) | |
7 | + should_not_see(authored_issue) | |
8 | + should_not_see(other_issue) | |
9 | + end | |
10 | + | |
11 | + step 'I should see issues authored by me' do | |
12 | + should_see(authored_issue) | |
13 | + should_not_see(assigned_issue) | |
14 | + should_not_see(other_issue) | |
15 | + end | |
16 | + | |
17 | + step 'I should see all issues' do | |
18 | + should_see(authored_issue) | |
19 | + should_see(assigned_issue) | |
20 | + should_see(other_issue) | |
21 | + end | |
22 | + | |
23 | + step 'I have authored issues' do | |
24 | + authored_issue | |
25 | + end | |
26 | + | |
27 | + step 'I have assigned issues' do | |
28 | + assigned_issue | |
29 | + end | |
30 | + | |
31 | + step 'I have other issues' do | |
32 | + other_issue | |
33 | + end | |
34 | + | |
35 | + step 'I click "Authored by me" link' do | |
36 | + within ".scope-filter" do | |
37 | + click_link 'Authored by me' | |
11 | 38 | end |
12 | 39 | end |
13 | 40 | |
14 | - And 'I have assigned issues' do | |
15 | - project = create :project | |
16 | - project.team << [@user, :master] | |
41 | + step 'I click "All" link' do | |
42 | + within ".scope-filter" do | |
43 | + click_link 'All' | |
44 | + end | |
45 | + end | |
46 | + | |
47 | + def should_see(issue) | |
48 | + page.should have_content(issue.title[0..10]) | |
49 | + end | |
50 | + | |
51 | + def should_not_see(issue) | |
52 | + page.should_not have_content(issue.title[0..10]) | |
53 | + end | |
54 | + | |
55 | + def assigned_issue | |
56 | + @assigned_issue ||= create :issue, assignee: current_user, project: project | |
57 | + end | |
58 | + | |
59 | + def authored_issue | |
60 | + @authored_issue ||= create :issue, author: current_user, project: project | |
61 | + end | |
62 | + | |
63 | + def other_issue | |
64 | + @other_issue ||= create :issue, project: project | |
65 | + end | |
17 | 66 | |
18 | - 2.times { create :issue, author: @user, assignee: @user, project: project } | |
67 | + def project | |
68 | + @project ||= begin | |
69 | + project =create :project_with_code | |
70 | + project.team << [current_user, :master] | |
71 | + project | |
72 | + end | |
19 | 73 | end |
20 | 74 | end | ... | ... |