2012-08-03 12:49:54 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-02-12 13:53:23 -05:00
|
|
|
describe 'Issues Feed', feature: true do
|
|
|
|
describe 'GET /issues' do
|
2012-11-05 22:31:55 -05:00
|
|
|
let!(:user) { create(:user) }
|
2016-11-03 06:29:37 -04:00
|
|
|
let!(:group) { create(:group) }
|
2013-09-05 07:46:34 -04:00
|
|
|
let!(:project) { create(:project) }
|
2012-11-05 22:31:55 -05:00
|
|
|
let!(:issue) { create(:issue, author: user, project: project) }
|
2012-09-12 08:01:50 -04:00
|
|
|
|
2016-11-03 06:29:37 -04:00
|
|
|
before do
|
|
|
|
project.team << [user, :developer]
|
|
|
|
group.add_developer(user)
|
|
|
|
end
|
2012-09-12 08:01:50 -04:00
|
|
|
|
2015-02-12 13:53:23 -05:00
|
|
|
context 'when authenticated' do
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'renders atom feed' do
|
2012-09-12 08:01:50 -04:00
|
|
|
login_with user
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_issues_path(project.namespace, project, :atom)
|
2012-09-12 08:01:50 -04:00
|
|
|
|
2017-02-22 17:50:15 -05:00
|
|
|
expect(response_headers['Content-Type']).
|
|
|
|
to have_content('application/atom+xml')
|
2015-02-12 13:53:23 -05:00
|
|
|
expect(body).to have_selector('title', text: "#{project.name} issues")
|
|
|
|
expect(body).to have_selector('author email', text: issue.author_email)
|
|
|
|
expect(body).to have_selector('entry summary', text: issue.title)
|
2012-09-12 08:01:50 -04:00
|
|
|
end
|
2012-08-03 12:49:54 -04:00
|
|
|
end
|
|
|
|
|
2015-02-12 13:53:23 -05:00
|
|
|
context 'when authenticated via private token' do
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'renders atom feed' do
|
2015-01-24 13:02:58 -05:00
|
|
|
visit namespace_project_issues_path(project.namespace, project, :atom,
|
|
|
|
private_token: user.private_token)
|
2012-08-03 12:49:54 -04:00
|
|
|
|
2017-02-22 17:50:15 -05:00
|
|
|
expect(response_headers['Content-Type']).
|
|
|
|
to have_content('application/atom+xml')
|
2015-02-12 13:53:23 -05:00
|
|
|
expect(body).to have_selector('title', text: "#{project.name} issues")
|
|
|
|
expect(body).to have_selector('author email', text: issue.author_email)
|
|
|
|
expect(body).to have_selector('entry summary', text: issue.title)
|
2012-09-12 08:01:50 -04:00
|
|
|
end
|
2012-08-03 12:49:54 -04:00
|
|
|
end
|
2016-11-03 06:29:37 -04:00
|
|
|
|
|
|
|
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"]')
|
2017-02-21 19:51:36 -05:00
|
|
|
params = CGI.parse(URI.parse(link[:href]).query)
|
2016-11-03 06:29:37 -04:00
|
|
|
|
|
|
|
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"]')
|
2017-02-21 19:51:36 -05:00
|
|
|
params = CGI.parse(URI.parse(link[:href]).query)
|
2016-11-03 06:29:37 -04:00
|
|
|
|
|
|
|
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
|
2012-08-03 12:49:54 -04:00
|
|
|
end
|
|
|
|
end
|