Welcome to mirror list, hosted at ThFree Co, Russian Federation.

branches.rb « fixtures « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3bb4b8873ad052dce1c0dc2f064e37b9636343d (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
42
43
44
45
46
47
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Branches (JavaScript fixtures)' do
  include JavaScriptFixturesHelpers

  let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
  let_it_be(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') }
  let_it_be(:user) { project.first_owner }

  after(:all) do
    remove_repository(project)
  end

  describe Projects::BranchesController, '(JavaScript fixtures)', type: :controller do
    render_views

    before do
      sign_in(user)
    end

    it 'branches/new_branch.html' do
      get :new, params: {
        namespace_id: project.namespace.to_param,
        project_id: project
      }

      expect(response).to be_successful
    end
  end

  describe API::Branches, '(JavaScript fixtures)', type: :request do
    include ApiHelpers

    it 'api/branches/branches.json' do
      # The search query "ma" matches a few branch names in the test
      # repository with a variety of different properties, including:
      # - "master": default, protected
      # - "markdown": non-default, protected
      # - "many_files": non-default, not protected
      get api("/projects/#{project.id}/repository/branches?search=ma", user)

      expect(response).to be_successful
    end
  end
end