Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-15 03:08:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-15 03:08:29 +0300
commit38b948a54e00841b51c446beb0adf079af60c963 (patch)
tree2e9dfe54e2d0ec444223f773dc283b1c639baae9 /spec/rubocop
parent7f35b02e86cd3d2e8b4a81c5c3a8483ff6973c5a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-rw-r--r--spec/rubocop/cop/gitlab/json_spec.rb27
1 files changed, 3 insertions, 24 deletions
diff --git a/spec/rubocop/cop/gitlab/json_spec.rb b/spec/rubocop/cop/gitlab/json_spec.rb
index 7a7982b2404..70f63a78dd1 100644
--- a/spec/rubocop/cop/gitlab/json_spec.rb
+++ b/spec/rubocop/cop/gitlab/json_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe RuboCop::Cop::Gitlab::Json do
class Foo
def bar
JSON.parse('{ "foo": "bar" }')
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `Gitlab::Json` over calling `JSON` or `to_json` directly. [...]
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `Gitlab::Json` over calling `JSON` directly. [...]
end
end
RUBY
@@ -31,7 +31,7 @@ RSpec.describe RuboCop::Cop::Gitlab::Json do
class Foo
def bar
JSON.parse('{ "foo": "bar" }')
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `Gitlab::Json` over calling `JSON` or `to_json` directly. [...]
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `Gitlab::Json` over calling `JSON` directly. [...]
end
end
RUBY
@@ -52,7 +52,7 @@ RSpec.describe RuboCop::Cop::Gitlab::Json do
class Foo
def bar
ActiveSupport::JSON.parse('{ "foo": "bar" }')
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `Gitlab::Json` over calling `JSON` or `to_json` directly. [...]
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer `Gitlab::Json` over calling `JSON` directly. [...]
end
end
RUBY
@@ -66,25 +66,4 @@ RSpec.describe RuboCop::Cop::Gitlab::Json do
RUBY
end
end
-
- context 'when .to_json is called' do
- it 'registers an offense and autocorrects' do
- expect_offense(<<~RUBY)
- class Foo
- def bar
- { foo: "bar" }.to_json
- ^^^^^^^^^^^^^^^^^^^^^^ Prefer `Gitlab::Json` over calling `JSON` or `to_json` directly. [...]
- end
- end
- RUBY
-
- expect_correction(<<~RUBY)
- class Foo
- def bar
- Gitlab::Json.dump({ foo: "bar" })
- end
- end
- RUBY
- end
- end
end