blob: 12f6fbd793ecc5b4eb56bbad0d0df50e5551a0f6 (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'getting blobs in a project repository' do
include GraphqlHelpers
let(:project) { create(:project, :repository) }
let(:current_user) { project.owner }
let(:paths) { ["CONTRIBUTING.md", "README.md"] }
let(:ref) { project.default_branch }
let(:fields) do
<<~QUERY
blobs(paths:#{paths.inspect}, ref:#{ref.inspect}) {
nodes {
#{all_graphql_fields_for('repository_blob'.classify)}
}
}
QUERY
end
let(:query) do
graphql_query_for(
'project',
{ 'fullPath' => project.full_path },
query_graphql_field('repository', {}, fields)
)
end
subject(:blobs) { graphql_data_at(:project, :repository, :blobs, :nodes) }
it 'returns the blob' do
post_graphql(query, current_user: current_user)
expect(blobs).to match_array(paths.map { |path| a_hash_including('path' => path) })
end
end
|