2019-02-27 04:22:04 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', type: :controller do
|
2019-02-27 04:22:04 -05:00
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
2020-12-07 07:10:00 -05:00
|
|
|
let_it_be(:user) { create(:user) }
|
2020-03-26 14:08:03 -04:00
|
|
|
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-02-27 04:22:04 -05:00
|
|
|
|
|
|
|
before do
|
2020-12-07 07:10:00 -05:00
|
|
|
group.add_owner(user)
|
|
|
|
sign_in(user)
|
2019-02-27 04:22:04 -05:00
|
|
|
end
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'autocomplete_sources/labels.json' do
|
2019-02-27 04:22:04 -05: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 11:06:38 -04: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 04:22:04 -05: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 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2019-02-27 04:22:04 -05:00
|
|
|
end
|
|
|
|
end
|