diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-09-01 00:39:27 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-09-01 17:46:41 +0300 |
commit | 0e9b26d1da453b45d73696f3d42cb605bff831b0 (patch) | |
tree | f62dbcffe11735ccd59ddc0351096f846d0a3fd0 /spec/features/issues | |
parent | 98e6a150ab48b2aaf8ea19571c1e2da249cd9b17 (diff) |
Reduce duplication in RSS feed specs for filter_issues_spec
Diffstat (limited to 'spec/features/issues')
-rw-r--r-- | spec/features/issues/filtered_search/filter_issues_spec.rb | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index e29e06bb70a..2ede552eff2 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -538,34 +538,32 @@ describe 'Filter issues', js: true do group.add_developer(user) end - it 'updates atom feed link for project issues' do - visit project_issues_path(project, milestone_title: milestone.title, assignee_id: user.id) - link = find_link('Subscribe') - params = CGI.parse(URI.parse(link[:href]).query) - auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) - auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query) - - expect(params).to include('rss_token' => [user.rss_token]) - expect(params).to include('milestone_title' => [milestone.title]) - expect(params).to include('assignee_id' => [user.id.to_s]) - expect(auto_discovery_params).to include('rss_token' => [user.rss_token]) - expect(auto_discovery_params).to include('milestone_title' => [milestone.title]) - expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + shared_examples 'updates atom feed link' do |type| + it "for #{type}" do + visit path + + link = find_link('Subscribe') + params = CGI.parse(URI.parse(link[:href]).query) + auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) + auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query) + + expected = { + 'rss_token' => [user.rss_token], + 'milestone_title' => [milestone.title], + 'assignee_id' => [user.id.to_s] + } + + expect(params).to include(expected) + expect(auto_discovery_params).to include(expected) + end + end + + it_behaves_like 'updates atom feed link', :project do + let(:path) { project_issues_path(project, milestone_title: milestone.title, assignee_id: user.id) } end - it 'updates atom feed link for group issues' do - visit issues_group_path(group, milestone_title: milestone.title, assignee_id: user.id) - link = find('.breadcrumbs a', text: 'Subscribe') - params = CGI.parse(URI.parse(link[:href]).query) - auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) - auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query) - - expect(params).to include('rss_token' => [user.rss_token]) - expect(params).to include('milestone_title' => [milestone.title]) - expect(params).to include('assignee_id' => [user.id.to_s]) - expect(auto_discovery_params).to include('rss_token' => [user.rss_token]) - expect(auto_discovery_params).to include('milestone_title' => [milestone.title]) - expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + it_behaves_like 'updates atom feed link', :group do + let(:path) { issues_group_path(group, milestone_title: milestone.title, assignee_id: user.id) } end end |