diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-02-25 16:41:19 +0300 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-02-27 11:08:41 +0300 |
commit | 4be7be6dbc3cf0ed6b86d36712713458a04a1d90 (patch) | |
tree | 165075c7a69f86125abdd677f4fe18fb3a74e531 /spec/javascripts/fixtures | |
parent | 13c723f1dd99a6488df0efc89f46cdae1e57126d (diff) |
Add JSON fixture for labels autocomplete source
Diffstat (limited to 'spec/javascripts/fixtures')
-rw-r--r-- | spec/javascripts/fixtures/autocomplete_sources.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/javascripts/fixtures/autocomplete_sources.rb b/spec/javascripts/fixtures/autocomplete_sources.rb new file mode 100644 index 00000000000..c117fb7cd24 --- /dev/null +++ b/spec/javascripts/fixtures/autocomplete_sources.rb @@ -0,0 +1,40 @@ +# 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 + + it 'autocomplete_sources/labels.json' do |example| + 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') + + get :labels, + format: :json, + params: { + namespace_id: group.path, + project_id: project.path, + type: issue.class.name, + type_id: issue.id + } + + expect(response).to be_success + store_frontend_fixture(response, example.description) + end +end |