diff options
Diffstat (limited to 'spec/lib/bulk_imports/groups/graphql/get_projects_query_spec.rb')
-rw-r--r-- | spec/lib/bulk_imports/groups/graphql/get_projects_query_spec.rb | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/spec/lib/bulk_imports/groups/graphql/get_projects_query_spec.rb b/spec/lib/bulk_imports/groups/graphql/get_projects_query_spec.rb index 1a7c5a4993c..fe28e3959a0 100644 --- a/spec/lib/bulk_imports/groups/graphql/get_projects_query_spec.rb +++ b/spec/lib/bulk_imports/groups/graphql/get_projects_query_spec.rb @@ -3,25 +3,25 @@ require 'spec_helper' RSpec.describe BulkImports::Groups::Graphql::GetProjectsQuery do - describe '#variables' do - it 'returns valid variables based on entity information' do - tracker = create(:bulk_import_tracker) - context = BulkImports::Pipeline::Context.new(tracker) - - query = GraphQL::Query.new( - GitlabSchema, - described_class.to_s, - variables: described_class.variables(context) - ) - result = GitlabSchema.static_validator.validate(query) - - expect(result[:errors]).to be_empty - end + let_it_be(:tracker) { create(:bulk_import_tracker) } + let_it_be(:context) { BulkImports::Pipeline::Context.new(tracker) } + + subject(:query) { described_class.new(context: context) } + + it 'has a valid query' do + parsed_query = GraphQL::Query.new( + GitlabSchema, + query.to_s, + variables: query.variables + ) + result = GitlabSchema.static_validator.validate(parsed_query) + + expect(result[:errors]).to be_empty + end - context 'with invalid variables' do - it 'raises an error' do - expect { GraphQL::Query.new(GitlabSchema, described_class.to_s, variables: 'invalid') }.to raise_error(ArgumentError) - end + context 'with invalid variables' do + it 'raises an error' do + expect { GraphQL::Query.new(GitlabSchema, subject.to_s, variables: 'invalid') }.to raise_error(ArgumentError) end end @@ -29,7 +29,7 @@ RSpec.describe BulkImports::Groups::Graphql::GetProjectsQuery do it 'returns data path' do expected = %w[data group projects nodes] - expect(described_class.data_path).to eq(expected) + expect(subject.data_path).to eq(expected) end end @@ -37,7 +37,7 @@ RSpec.describe BulkImports::Groups::Graphql::GetProjectsQuery do it 'returns pagination information path' do expected = %w[data group projects page_info] - expect(described_class.page_info_path).to eq(expected) + expect(subject.page_info_path).to eq(expected) end end end |