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
def extract(context)
client = graphql_client(context)
Enumerator.new do |yielder|
result = client.execute(
client.parse(query.to_s),
query.variables(context.entity)
)
yielder << result.original_hash.deep_dup
end
client.execute(
client.parse(query.to_s),
query.variables(context.entity)
).original_hash.deep_dup
end
private
......
......@@ -27,11 +27,8 @@ RSpec.describe BulkImports::Common::Extractors::GraphqlExtractor do
allow(graphql_client).to receive(:execute).and_return(response)
end
it 'returns an enumerator with fetched results' do
response = subject.extract(context)
expect(response).to be_instance_of(Enumerator)
expect(response.first).to eq({ foo: :bar })
it 'returns original hash' do
expect(subject.extract(context)).to eq({ foo: :bar })
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