2017-02-13 17:35:08 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-02-13 19:09:57 -05:00
|
|
|
describe 'Todos (JavaScript fixtures)' do
|
2017-02-13 17:35:08 -05:00
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
|
|
|
let(:admin) { create(:admin) }
|
|
|
|
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
|
|
|
let(:project) { create(:project_empty_repo, namespace: namespace, path: 'todos-project') }
|
|
|
|
let(:issue_1) { create(:issue, title: 'issue_1', project: project) }
|
|
|
|
let!(:todo_1) { create(:todo, user: admin, project: project, target: issue_1, created_at: 5.hours.ago) }
|
|
|
|
let(:issue_2) { create(:issue, title: 'issue_2', project: project) }
|
|
|
|
let!(:todo_2) { create(:todo, :done, user: admin, project: project, target: issue_2, created_at: 50.hours.ago) }
|
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('todos/')
|
|
|
|
end
|
|
|
|
|
2017-08-22 19:19:35 -04:00
|
|
|
after do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
|
|
|
|
2017-02-13 19:09:57 -05:00
|
|
|
describe Dashboard::TodosController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
render_views
|
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2017-02-13 19:09:57 -05:00
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'todos/todos.html' do
|
2017-02-13 19:09:57 -05:00
|
|
|
get :index
|
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2017-02-13 19:09:57 -05:00
|
|
|
end
|
2017-02-13 17:35:08 -05:00
|
|
|
end
|
|
|
|
|
2017-02-13 19:09:57 -05:00
|
|
|
describe Projects::TodosController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
render_views
|
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2017-02-13 19:09:57 -05:00
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'todos/todos.json' do
|
2018-12-19 14:50:20 -05:00
|
|
|
post :create, params: {
|
2017-02-23 18:55:01 -05:00
|
|
|
namespace_id: namespace,
|
|
|
|
project_id: project,
|
2017-02-13 19:09:57 -05:00
|
|
|
issuable_type: 'issue',
|
2018-12-19 14:50:20 -05:00
|
|
|
issuable_id: issue_2.id
|
|
|
|
}, format: 'json'
|
2017-02-13 17:35:08 -05:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2017-02-13 19:09:57 -05:00
|
|
|
end
|
2017-02-13 17:35:08 -05:00
|
|
|
end
|
|
|
|
end
|