summaryrefslogtreecommitdiff
path: root/spec/frontend/fixtures/autocomplete.rb
blob: 8983e241aa5230bb300c66cad0dbf27879a4f7c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ::AutocompleteController, '(JavaScript fixtures)', type: :controller do
  include JavaScriptFixturesHelpers

  let_it_be(:user) { create(:user) }
  let_it_be(:group) { create(:group, name: 'frontend-fixtures') }

  let(:project) { create(:project, namespace: group, path: 'autocomplete-project') }
  let(:merge_request) { create(:merge_request, source_project: project, author: user) }

  before(:all) do
    clean_frontend_fixtures('autocomplete/')
  end

  before do
    group.add_owner(user)
    sign_in(user)
  end

  it 'autocomplete/users.json' do
    20.times do
      user = create(:user)
      project.add_developer(user)
    end

    get :users,
        format: :json,
        params: {
          project_id: project.id,
          active: true,
          current_user: true,
          author: merge_request.author.id,
          merge_request_iid: merge_request.iid
        }

    expect(response).to be_successful
  end
end