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

project.rb « fixtures « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6100248d0a58d0678cf40e214cc7d8164677ab3a (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
48
49
50
51
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Project (GraphQL fixtures)', feature_category: :groups_and_projects do
  describe GraphQL::Query, type: :request do
    include ApiHelpers
    include GraphqlHelpers
    include JavaScriptFixturesHelpers
    include ProjectForksHelper

    let_it_be(:project) { create(:project, :repository) }
    let_it_be(:current_user) { create(:user) }

    describe 'writable forks' do
      writeable_forks_query_path = 'vue_shared/components/web_ide/get_writable_forks.query.graphql'

      let(:query) { get_graphql_query_as_string(writeable_forks_query_path) }

      subject { post_graphql(query, current_user: current_user, variables: { projectPath: project.full_path }) }

      before do
        project.add_developer(current_user)
      end

      context 'with none' do
        it "graphql/#{writeable_forks_query_path}_none.json" do
          subject

          expect_graphql_errors_to_be_empty
        end
      end

      context 'with some' do
        let_it_be(:fork1) { fork_project(project, nil, repository: true) }
        let_it_be(:fork2) { fork_project(project, nil, repository: true) }

        before_all do
          fork1.add_developer(current_user)
          fork2.add_developer(current_user)
        end

        it "graphql/#{writeable_forks_query_path}_some.json" do
          subject

          expect_graphql_errors_to_be_empty
        end
      end
    end
  end
end