diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-22 15:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-22 15:10:04 +0300 |
commit | cb8bd7d5946ca50a2de99645687a633a0c8105be (patch) | |
tree | a327e4da74f2a2d050a6971e0e03d41e5b0c5780 /spec/rubocop | |
parent | 8e0dafbb6665d431f7f1b635c0f7c4a5c61bc325 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-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 |