diff options
Diffstat (limited to 'spec/rubocop/cop/gitlab/json_spec.rb')
-rw-r--r-- | spec/rubocop/cop/gitlab/json_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/rubocop/cop/gitlab/json_spec.rb b/spec/rubocop/cop/gitlab/json_spec.rb index 66b2c675e80..7998f26da4e 100644 --- a/spec/rubocop/cop/gitlab/json_spec.rb +++ b/spec/rubocop/cop/gitlab/json_spec.rb @@ -6,7 +6,7 @@ require_relative '../../../../rubocop/cop/gitlab/json' RSpec.describe RuboCop::Cop::Gitlab::Json do subject(:cop) { described_class.new } - context 'when JSON is called' do + context 'when ::JSON is called' do it 'registers an offense' do expect_offense(<<~RUBY) class Foo @@ -18,4 +18,17 @@ RSpec.describe RuboCop::Cop::Gitlab::Json do RUBY end end + + context 'when ActiveSupport::JSON is called' do + it 'registers an offense' do + expect_offense(<<~RUBY) + class Foo + def bar + ActiveSupport::JSON.parse('{ "foo": "bar" }') + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid calling `JSON` directly. [...] + end + end + RUBY + end + end end |