diff options
Diffstat (limited to 'spec/rubocop/cop/code_reuse/worker_spec.rb')
-rw-r--r-- | spec/rubocop/cop/code_reuse/worker_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/rubocop/cop/code_reuse/worker_spec.rb b/spec/rubocop/cop/code_reuse/worker_spec.rb index 8155791a3e3..a548e90d8e1 100644 --- a/spec/rubocop/cop/code_reuse/worker_spec.rb +++ b/spec/rubocop/cop/code_reuse/worker_spec.rb @@ -31,7 +31,24 @@ RSpec.describe RuboCop::Cop::CodeReuse::Worker do resource :projects do get '/' do FooWorker.perform_async - ^^^^^^^^^^^^^^^^^^^^^^^ Workers can not be used in a Grape API. + ^^^^^^^^^^^^^^^^^^^^^^^ Workers can not be used in an API endpoint. + end + end + end + SOURCE + end + + it 'flags the use of a worker in GraphQL' do + allow(cop) + .to receive(:in_graphql?) + .and_return(true) + + expect_offense(<<~SOURCE) + module Mutations + class Foo < BaseMutation + def resolve + FooWorker.perform_async + ^^^^^^^^^^^^^^^^^^^^^^^ Workers can not be used in an API endpoint. end end end |