2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', type: :controller do
|
2019-07-07 11:18:12 +05:30
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
let_it_be(:admin) { create(:admin) }
|
|
|
|
let_it_be(:group) { create(:group, name: 'frontend-fixtures') }
|
|
|
|
let_it_be(:project) { create(:project, namespace: group, path: 'autocomplete-sources-project') }
|
|
|
|
let_it_be(:issue) { create(:issue, project: project) }
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('autocomplete_sources/')
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
it 'autocomplete_sources/labels.json' do
|
2019-07-07 11:18:12 +05:30
|
|
|
issue.labels << create(:label, project: project, title: 'bug')
|
|
|
|
issue.labels << create(:label, project: project, title: 'critical')
|
|
|
|
|
|
|
|
create(:label, project: project, title: 'feature')
|
|
|
|
create(:label, project: project, title: 'documentation')
|
2019-12-21 20:55:43 +05:30
|
|
|
create(:label, project: project, title: 'P1')
|
|
|
|
create(:label, project: project, title: 'P2')
|
|
|
|
create(:label, project: project, title: 'P3')
|
|
|
|
create(:label, project: project, title: 'P4')
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
get :labels,
|
|
|
|
format: :json,
|
|
|
|
params: {
|
|
|
|
namespace_id: group.path,
|
|
|
|
project_id: project.path,
|
|
|
|
type: issue.class.name,
|
|
|
|
type_id: issue.id
|
|
|
|
}
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
expect(response).to be_successful
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
end
|