diff options
author | charlieablett <cablett@gitlab.com> | 2019-07-02 08:32:44 +0300 |
---|---|---|
committer | charlieablett <cablett@gitlab.com> | 2019-07-05 01:18:50 +0300 |
commit | 675c9b9f6bec35f1e6988a42c4fa6a6f8331d14f (patch) | |
tree | c96af65aa258cb557e7d714c7408eec037525fdf /spec/lib/gitlab/graphql | |
parent | cf1b0d10bcdde69f05695a2e9a0d380c6badb6d1 (diff) |
Address reviewer comments
- Remove Gitaly call check for fields that have a constant complexity
declared
- Add associated test
Diffstat (limited to 'spec/lib/gitlab/graphql')
-rw-r--r-- | spec/lib/gitlab/graphql/calls_gitaly/instrumentation_spec.rb | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/spec/lib/gitlab/graphql/calls_gitaly/instrumentation_spec.rb b/spec/lib/gitlab/graphql/calls_gitaly/instrumentation_spec.rb index 92d200bfd4e..d93ce464a92 100644 --- a/spec/lib/gitlab/graphql/calls_gitaly/instrumentation_spec.rb +++ b/spec/lib/gitlab/graphql/calls_gitaly/instrumentation_spec.rb @@ -4,25 +4,19 @@ require 'spec_helper' describe Gitlab::Graphql::CallsGitaly::Instrumentation do subject { described_class.new } - context 'when considering complexity' do - describe '#calls_gitaly_check' do - let(:gitaly_field) { Types::BaseField.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true) } - let(:no_gitaly_field) { Types::BaseField.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, calls_gitaly: false) } + describe '#calls_gitaly_check' do + let(:gitaly_field) { Types::BaseField.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true) } + let(:no_gitaly_field) { Types::BaseField.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, calls_gitaly: false) } - context 'if there are no Gitaly calls' do - it 'does not raise an error if calls_gitaly is false' do - expect { subject.send(:calls_gitaly_check, no_gitaly_field, 0) }.not_to raise_error - end + context 'if there are no Gitaly calls' do + it 'does not raise an error if calls_gitaly is false' do + expect { subject.send(:calls_gitaly_check, no_gitaly_field, 0) }.not_to raise_error end + end - context 'if there is at least 1 Gitaly call' do - it 'does not raise an error if calls_gitaly is true' do - expect { subject.send(:calls_gitaly_check, gitaly_field, 1) }.not_to raise_error - end - - it 'raises an error if calls_gitaly: is false or not defined' do - expect { subject.send(:calls_gitaly_check, no_gitaly_field, 1) }.to raise_error(/please add `calls_gitaly: true`/) - end + context 'if there is at least 1 Gitaly call' do + it 'raises an error if calls_gitaly: is false or not defined' do + expect { subject.send(:calls_gitaly_check, no_gitaly_field, 1) }.to raise_error(/specify a constant complexity or add `calls_gitaly: true`/) end end end |