diff options
author | Lucas Deschamps <lucasdchamps@gmail.com> | 2016-11-03 13:29:37 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-11-03 20:26:06 +0300 |
commit | d84eb9abd6e851cfe86d4dc64e0ceff9aa9acbc0 (patch) | |
tree | b89352b1d086d907403955ac55d78895cf0dbbbf /spec | |
parent | 651bdd7c34c9ebf686b8357d8fc3ca4d0a58792e (diff) |
Issues atom feed url reflect filters on dashboard
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/atom/dashboard_issues_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/atom/issues_spec.rb | 29 | ||||
-rw-r--r-- | spec/features/dashboard_issues_spec.rb | 20 | ||||
-rw-r--r-- | spec/features/issues/filter_issues_spec.rb | 34 |
4 files changed, 91 insertions, 3 deletions
diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/features/atom/dashboard_issues_spec.rb index 4dd9548cfc5..21ee6cedbae 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/features/atom/dashboard_issues_spec.rb @@ -19,6 +19,17 @@ describe "Dashboard Issues Feed", feature: true do expect(body).to have_selector('title', text: "#{user.name} issues") end + it "renders atom feed with url parameters" do + visit issues_dashboard_path(:atom, private_token: user.private_token, state: 'opened', assignee_id: user.id) + + link = find('link[type="application/atom+xml"]') + params = CGI::parse(URI.parse(link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('state' => ['opened']) + expect(params).to include('assignee_id' => [user.id.to_s]) + end + context "issue with basic fields" do let!(:issue2) { create(:issue, author: user, assignee: user, project: project2, description: 'test desc') } diff --git a/spec/features/atom/issues_spec.rb b/spec/features/atom/issues_spec.rb index 09c140868fb..863412d18eb 100644 --- a/spec/features/atom/issues_spec.rb +++ b/spec/features/atom/issues_spec.rb @@ -3,10 +3,14 @@ require 'spec_helper' describe 'Issues Feed', feature: true do describe 'GET /issues' do let!(:user) { create(:user) } + let!(:group) { create(:group) } let!(:project) { create(:project) } let!(:issue) { create(:issue, author: user, project: project) } - before { project.team << [user, :developer] } + before do + project.team << [user, :developer] + group.add_developer(user) + end context 'when authenticated' do it 'renders atom feed' do @@ -33,5 +37,28 @@ describe 'Issues Feed', feature: true do expect(body).to have_selector('entry summary', text: issue.title) end end + + it "renders atom feed with url parameters for project issues" do + visit namespace_project_issues_path(project.namespace, project, + :atom, private_token: user.private_token, state: 'opened', assignee_id: user.id) + + link = find('link[type="application/atom+xml"]') + params = CGI::parse(URI.parse(link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('state' => ['opened']) + expect(params).to include('assignee_id' => [user.id.to_s]) + end + + it "renders atom feed with url parameters for group issues" do + visit issues_group_path(group, :atom, private_token: user.private_token, state: 'opened', assignee_id: user.id) + + link = find('link[type="application/atom+xml"]') + params = CGI::parse(URI.parse(link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('state' => ['opened']) + expect(params).to include('assignee_id' => [user.id.to_s]) + end end end diff --git a/spec/features/dashboard_issues_spec.rb b/spec/features/dashboard_issues_spec.rb index 9b54b5301e5..b898f9bc64f 100644 --- a/spec/features/dashboard_issues_spec.rb +++ b/spec/features/dashboard_issues_spec.rb @@ -44,6 +44,22 @@ describe "Dashboard Issues filtering", feature: true, js: true do expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_selector('.issue', count: 1) end + + it 'updates atom feed link' do + visit_issues(milestone_title: '', assignee_id: user.id) + + link = find('.nav-controls 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('private_token' => [user.private_token]) + expect(params).to include('milestone_title' => ['']) + expect(params).to include('assignee_id' => [user.id.to_s]) + expect(auto_discovery_params).to include('private_token' => [user.private_token]) + expect(auto_discovery_params).to include('milestone_title' => ['']) + expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + end end def show_milestone_dropdown @@ -51,7 +67,7 @@ describe "Dashboard Issues filtering", feature: true, js: true do expect(page).to have_selector('.dropdown-content', visible: true) end - def visit_issues - visit issues_dashboard_path + def visit_issues(*args) + visit issues_dashboard_path(*args) end end diff --git a/spec/features/issues/filter_issues_spec.rb b/spec/features/issues/filter_issues_spec.rb index 78208aed46d..2798db92f0f 100644 --- a/spec/features/issues/filter_issues_spec.rb +++ b/spec/features/issues/filter_issues_spec.rb @@ -4,6 +4,7 @@ describe 'Filter issues', feature: true do include WaitForAjax let!(:project) { create(:project) } + let!(:group) { create(:group) } let!(:user) { create(:user)} let!(:milestone) { create(:milestone, project: project) } let!(:label) { create(:label, project: project) } @@ -11,6 +12,7 @@ describe 'Filter issues', feature: true do before do project.team << [user, :master] + group.add_developer(user) login_as(user) create(:issue, project: project) end @@ -347,4 +349,36 @@ describe 'Filter issues', feature: true do end end end + + it 'updates atom feed link for project issues' do + visit namespace_project_issues_path(project.namespace, project, milestone_title: '', assignee_id: user.id) + + link = find('.nav-controls 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('private_token' => [user.private_token]) + expect(params).to include('milestone_title' => ['']) + expect(params).to include('assignee_id' => [user.id.to_s]) + expect(auto_discovery_params).to include('private_token' => [user.private_token]) + expect(auto_discovery_params).to include('milestone_title' => ['']) + expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + end + + it 'updates atom feed link for group issues' do + visit issues_group_path(group, milestone_title: '', assignee_id: user.id) + + link = find('.nav-controls 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('private_token' => [user.private_token]) + expect(params).to include('milestone_title' => ['']) + expect(params).to include('assignee_id' => [user.id.to_s]) + expect(auto_discovery_params).to include('private_token' => [user.private_token]) + expect(auto_discovery_params).to include('milestone_title' => ['']) + expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + end end |