Commit 0e9b26d1 authored by Robert Speicher's avatar Robert Speicher

Reduce duplication in RSS feed specs for filter_issues_spec

parent 98e6a150
...@@ -538,34 +538,32 @@ describe 'Filter issues', js: true do ...@@ -538,34 +538,32 @@ describe 'Filter issues', js: true do
group.add_developer(user) group.add_developer(user)
end end
it 'updates atom feed link for project issues' do shared_examples 'updates atom feed link' do |type|
visit project_issues_path(project, milestone_title: milestone.title, assignee_id: user.id) it "for #{type}" do
visit path
link = find_link('Subscribe') link = find_link('Subscribe')
params = CGI.parse(URI.parse(link[:href]).query) params = CGI.parse(URI.parse(link[:href]).query)
auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) auto_discovery_link = find('link[type="application/atom+xml"]', visible: false)
auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query) auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query)
expect(params).to include('rss_token' => [user.rss_token]) expected = {
expect(params).to include('milestone_title' => [milestone.title]) 'rss_token' => [user.rss_token],
expect(params).to include('assignee_id' => [user.id.to_s]) 'milestone_title' => [milestone.title],
expect(auto_discovery_params).to include('rss_token' => [user.rss_token]) 'assignee_id' => [user.id.to_s]
expect(auto_discovery_params).to include('milestone_title' => [milestone.title]) }
expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s])
expect(params).to include(expected)
expect(auto_discovery_params).to include(expected)
end
end end
it 'updates atom feed link for group issues' do it_behaves_like 'updates atom feed link', :project do
visit issues_group_path(group, milestone_title: milestone.title, assignee_id: user.id) let(:path) { project_issues_path(project, milestone_title: milestone.title, assignee_id: user.id) }
link = find('.breadcrumbs a', text: 'Subscribe') end
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]) it_behaves_like 'updates atom feed link', :group do
expect(params).to include('milestone_title' => [milestone.title]) let(:path) { issues_group_path(group, milestone_title: milestone.title, assignee_id: user.id) }
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])
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment