summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop/graphql/authorize_types_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubocop/cop/graphql/authorize_types_spec.rb')
-rw-r--r--spec/rubocop/cop/graphql/authorize_types_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/rubocop/cop/graphql/authorize_types_spec.rb b/spec/rubocop/cop/graphql/authorize_types_spec.rb
index eae3e176d64..af4315ecd34 100644
--- a/spec/rubocop/cop/graphql/authorize_types_spec.rb
+++ b/spec/rubocop/cop/graphql/authorize_types_spec.rb
@@ -11,6 +11,23 @@ describe RuboCop::Cop::Graphql::AuthorizeTypes do
subject(:cop) { described_class.new }
+ context 'when NOT in a type folder' do
+ before do
+ allow(cop).to receive(:in_type?).and_return(false)
+ end
+
+ it 'does not add an offense even though there is no authorize call' do
+ expect_no_offenses(<<~TYPE.strip)
+ module Types
+ class AType < BaseObject
+ field :a_thing
+ field :another_thing
+ end
+ end
+ TYPE
+ end
+ end
+
context 'when in a type folder' do
before do
allow(cop).to receive(:in_type?).and_return(true)