Skip to content

Commit

Permalink
Restore skipped specs for Prism
Browse files Browse the repository at this point in the history
This PR restores skipped specs for Prism.
They have already been resolved in Prism, so they can be tested.
  • Loading branch information
koic committed May 10, 2024
1 parent eab7722 commit 875bdb4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@
RUBY
end

# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it 'registers an offense when the method is called with no receiver', broken_on: :prism do
it 'registers an offense when the method is called with no receiver' do
expect_offense(<<~RUBY)
all? do |e|
[1, 2, 3].include?(e)
Expand Down
4 changes: 1 addition & 3 deletions spec/rubocop/cop/performance/redundant_merge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
end
end

# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
context 'when receiver is implicit', broken_on: :prism do
context 'when receiver is implicit' do
it "doesn't autocorrect" do
new_source = autocorrect_source('merge!(foo: 1, bar: 2)')
expect(new_source).to eq('merge!(foo: 1, bar: 2)')
Expand Down
16 changes: 4 additions & 12 deletions spec/rubocop/cop/performance/string_identifier_argument_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
RUBY
end
else
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it "registers an offense when using string argument for `#{method}` method", broken_on: :prism do
it "registers an offense when using string argument for `#{method}` method" do
expect_offense(<<~RUBY, method: method)
#{method}('do_something')
_{method} ^^^^^^^^^^^^^^ Use `:do_something` instead of `'do_something'`.
Expand All @@ -40,18 +38,14 @@
RUBY
end

# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it "does not register an offense when using symbol argument for `#{method}` method", broken_on: :prism do
it "does not register an offense when using symbol argument for `#{method}` method" do
expect_no_offenses(<<~RUBY)
#{method}(:do_something)
RUBY
end

if described_class::INTERPOLATION_IGNORE_METHODS.include?(method)
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it 'does not register an offense when using string interpolation for `#{method}` method', broken_on: :prism do
it 'does not register an offense when using string interpolation for `#{method}` method' do
# NOTE: These methods don't support `::` when passing a symbol. const_get('A::B') is valid
# but const_get(:'A::B') isn't. Since interpolated arguments may contain any content these
# cases are not detected as an offense to prevent false positives.
Expand All @@ -60,9 +54,7 @@
RUBY
end
else
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0. It has been resolved in
# the development line. This will be resolved in Prism > 0.24.0 and higher releases.
it 'registers an offense when using interpolated string argument', broken_on: :prism do
it 'registers an offense when using interpolated string argument' do
expect_offense(<<~RUBY, method: method)
#{method}("do_something_\#{var}")
_{method} ^^^^^^^^^^^^^^^^^^^^^ Use `:"do_something_\#{var}"` instead of `"do_something_\#{var}"`.
Expand Down

0 comments on commit 875bdb4

Please sign in to comment.