2016-08-29 12:18:59 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
|
|
|
let(:admin) { create(:admin) }
|
2016-11-19 18:40:37 -05:00
|
|
|
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
|
|
|
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'issues-project') }
|
2016-08-29 12:18:59 -04:00
|
|
|
|
|
|
|
render_views
|
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('issues/')
|
|
|
|
end
|
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2016-08-29 12:18:59 -04:00
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2017-08-22 19:19:35 -04:00
|
|
|
after do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
|
|
|
|
2016-08-29 12:18:59 -04:00
|
|
|
it 'issues/open-issue.html.raw' do |example|
|
|
|
|
render_issue(example.description, create(:issue, project: project))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'issues/closed-issue.html.raw' do |example|
|
|
|
|
render_issue(example.description, create(:closed_issue, project: project))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'issues/issue-with-task-list.html.raw' do |example|
|
2016-11-22 17:46:58 -05:00
|
|
|
issue = create(:issue, project: project, description: '- [ ] Task List Item')
|
|
|
|
render_issue(example.description, issue)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'issues/issue_with_comment.html.raw' do |example|
|
2016-08-29 12:18:59 -04:00
|
|
|
issue = create(:issue, project: project)
|
2016-11-22 17:46:58 -05:00
|
|
|
create(:note, project: project, noteable: issue, note: '- [ ] Task List Item').save
|
2016-08-29 12:18:59 -04:00
|
|
|
render_issue(example.description, issue)
|
|
|
|
end
|
|
|
|
|
2017-05-22 07:27:08 -04:00
|
|
|
it 'issues/issue_list.html.raw' do |example|
|
|
|
|
create(:issue, project: project)
|
|
|
|
|
|
|
|
get :index,
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
store_frontend_fixture(response, example.description)
|
|
|
|
end
|
|
|
|
|
2016-08-29 12:18:59 -04:00
|
|
|
private
|
|
|
|
|
|
|
|
def render_issue(fixture_file_name, issue)
|
|
|
|
get :show,
|
|
|
|
namespace_id: project.namespace.to_param,
|
2017-02-23 18:55:01 -05:00
|
|
|
project_id: project,
|
2016-08-29 12:18:59 -04:00
|
|
|
id: issue.to_param
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
store_frontend_fixture(response, fixture_file_name)
|
|
|
|
end
|
|
|
|
end
|