Commit 9a614e57 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'georgekoltsov/fix-bulk-import-graphql-extractor' into 'master'

Update GraphqlExtractor return value to be original hash

See merge request gitlab-org/gitlab!51596
parents 6a41dc7a 3011b423
---
title: Update GraphqlExtractor return value to be original hash
merge_request: 51596
author:
type: fixed
...@@ -11,14 +11,10 @@ module BulkImports ...@@ -11,14 +11,10 @@ module BulkImports
def extract(context) def extract(context)
client = graphql_client(context) client = graphql_client(context)
Enumerator.new do |yielder| client.execute(
result = client.execute(
client.parse(query.to_s), client.parse(query.to_s),
query.variables(context.entity) query.variables(context.entity)
) ).original_hash.deep_dup
yielder << result.original_hash.deep_dup
end
end end
private private
......
...@@ -27,11 +27,8 @@ RSpec.describe BulkImports::Common::Extractors::GraphqlExtractor do ...@@ -27,11 +27,8 @@ RSpec.describe BulkImports::Common::Extractors::GraphqlExtractor do
allow(graphql_client).to receive(:execute).and_return(response) allow(graphql_client).to receive(:execute).and_return(response)
end end
it 'returns an enumerator with fetched results' do it 'returns original hash' do
response = subject.extract(context) expect(subject.extract(context)).to eq({ foo: :bar })
expect(response).to be_instance_of(Enumerator)
expect(response.first).to eq({ foo: :bar })
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment