2019-02-27 09:22:04 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
|
|
|
set(:admin) { create(:admin) }
|
|
|
|
set(:group) { create(:group, name: 'frontend-fixtures') }
|
|
|
|
set(:project) { create(:project, namespace: group, path: 'autocomplete-sources-project') }
|
|
|
|
set(:issue) { create(:issue, project: project) }
|
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('autocomplete_sources/')
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2019-04-21 10:58:07 +00:00
|
|
|
it 'autocomplete_sources/labels.json' do
|
2019-02-27 09:22:04 +00:00
|
|
|
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-10-04 15:06:38 +00:00
|
|
|
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-02-27 09:22:04 +00:00
|
|
|
|
|
|
|
get :labels,
|
|
|
|
format: :json,
|
|
|
|
params: {
|
|
|
|
namespace_id: group.path,
|
|
|
|
project_id: project.path,
|
|
|
|
type: issue.class.name,
|
|
|
|
type_id: issue.id
|
|
|
|
}
|
|
|
|
|
2019-07-17 22:15:53 +00:00
|
|
|
expect(response).to be_successful
|
2019-02-27 09:22:04 +00:00
|
|
|
end
|
|
|
|
end
|