summaryrefslogtreecommitdiff
path: root/spec/frontend/fixtures/api_projects.rb
blob: fa77ca1c0cf674a049666acb19e47ce454807d9f (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe API::Projects, '(JavaScript fixtures)', type: :request do
  include ApiHelpers
  include JavaScriptFixturesHelpers

  let(:admin) { create(:admin, name: 'root') }
  let(:namespace) { create(:namespace, name: 'gitlab-test' )}
  let(:project) { create(:project, :repository, namespace: namespace, path: 'lorem-ipsum') }
  let(:project_empty) { create(:project_empty_repo, namespace: namespace, path: 'lorem-ipsum-empty') }

  before(:all) do
    clean_frontend_fixtures('api/projects')
  end

  it 'api/projects/get.json' do
    get api("/projects/#{project.id}", admin)

    expect(response).to be_successful
  end

  it 'api/projects/get_empty.json' do
    get api("/projects/#{project_empty.id}", admin)

    expect(response).to be_successful
  end

  it 'api/projects/branches/get.json' do
    get api("/projects/#{project.id}/repository/branches/#{project.default_branch}", admin)

    expect(response).to be_successful
  end
end