diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-24 18:22:48 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-24 18:22:48 +0200 |
commit | 4c61c467385ca889bc273a171bcd1ebfb9e739e9 (patch) | |
tree | a551f91f9a5f13cf3cc876816546db9f73ed289f /features | |
parent | 5953582b65e1d49c3d04d9bc97069cb323ab277c (diff) | |
download | gitlab-ce-4c61c467385ca889bc273a171bcd1ebfb9e739e9.tar.gz |
Add tests to Dashboard#merge_requests filter
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'features')
-rw-r--r-- | features/dashboard/merge_requests.feature | 14 | ||||
-rw-r--r-- | features/steps/dashboard/dashboard_merge_requests.rb | 79 |
2 files changed, 74 insertions, 19 deletions
diff --git a/features/dashboard/merge_requests.feature b/features/dashboard/merge_requests.feature index cad65b0d79a..de560300735 100644 --- a/features/dashboard/merge_requests.feature +++ b/features/dashboard/merge_requests.feature @@ -2,7 +2,17 @@ Feature: Dashboard Merge Requests Background: Given I sign in as a user And I have authored merge requests + And I have assigned merge requests + And I have other merge requests And I visit dashboard merge requests page - Scenario: I should see projects list - Then I should see my merge requests + Scenario: I should see assigned merge_requests + Then I should see merge requests assigned to me + + Scenario: I should see authored merge_requests + When I click "Authored by me" link + Then I should see merge requests authored by me + + Scenario: I should see all merge_requests + When I click "All" link + Then I should see all merge requests diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb index 6c1fa39f081..3c35462a8db 100644 --- a/features/steps/dashboard/dashboard_merge_requests.rb +++ b/features/steps/dashboard/dashboard_merge_requests.rb @@ -2,28 +2,73 @@ class DashboardMergeRequests < Spinach::FeatureSteps include SharedAuthentication include SharedPaths - 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.target_project.name) - page.should have_content(mr.source_project.name) + step 'I should see merge requests assigned to me' do + should_see(assigned_merge_request) + should_not_see(authored_merge_request) + should_not_see(other_merge_request) + end + + step 'I should see merge requests authored by me' do + should_see(authored_merge_request) + should_not_see(assigned_merge_request) + should_not_see(other_merge_request) + end + + step 'I should see all merge requests' do + should_see(authored_merge_request) + should_see(assigned_merge_request) + should_see(other_merge_request) + end + + step 'I have authored merge requests' do + authored_merge_request + end + + step 'I have assigned merge requests' do + assigned_merge_request + end + + step 'I have other merge requests' do + other_merge_request + end + + step 'I click "Authored by me" link' do + within ".scope-filter" do + click_link 'Authored by me' + end + end + + step 'I click "All" link' do + within ".scope-filter" do + click_link 'All' end end - And 'I have authored merge requests' do - project1_source = create :project - project1_target= create :project - project2_source = create :project - project2_target = create :project + def should_see(merge_request) + page.should have_content(merge_request.title[0..10]) + end + def should_not_see(merge_request) + page.should_not have_content(merge_request.title[0..10]) + end - project1_source.team << [@user, :master] - project1_target.team << [@user, :master] - project2_source.team << [@user, :master] - project2_target.team << [@user, :master] + def assigned_merge_request + @assigned_merge_request ||= create :merge_request, assignee: current_user, target_project: project + end + + def authored_merge_request + @authored_merge_request ||= create :merge_request, author: current_user, target_project: project + end + + def other_merge_request + @other_merge_request ||= create :merge_request, target_project: project + end - merge_request1 = create :merge_request, author: @user, source_project: project1_source, target_project: project1_target - merge_request2 = create :merge_request, author: @user, source_project: project2_source, target_project: project2_target + def project + @project ||= begin + project =create :project_with_code + project.team << [current_user, :master] + project + end end end |