Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an error for Minitst/AssertOperator and Minitest/RefuteOperator #275

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
oldest_supported_rubocop:
runs-on: ubuntu-latest
name: The oldest supported RuboCop version
steps:
- uses: actions/checkout@v4
- name: Use the oldest supported RuboCop
run: |
sed -e "/gem 'rubocop', github: 'rubocop\/rubocop'/d" -i Gemfile
cat << EOF > Gemfile.local
gem 'rubocop', '1.39.0' # Specify the oldest supported RuboCop version
EOF
- name: set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: test
run: bundle exec rake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#275](https://github.com/rubocop/rubocop-minitest/pull/275): Make `Minitest/AssertMatch` aware of `assert_operator` when running with Ruby 2.7. ([@koic][])
2 changes: 1 addition & 1 deletion lib/rubocop/cop/minitest/assert_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def on_send(node)

def build_new_arguments(node)
lhs, op, rhs = *node.first_argument
new_arguments = "#{lhs.source}, :#{op}, #{rhs.source}"
new_arguments = +"#{lhs.source}, :#{op}, #{rhs.source}"

if node.arguments.count == 2
new_arguments << ", #{node.last_argument.source}"
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/minitest/refute_operator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def on_send(node)

def build_new_arguments(node)
lhs, op, rhs = *node.first_argument
new_arguments = "#{lhs.source}, :#{op}, #{rhs.source}"
new_arguments = +"#{lhs.source}, :#{op}, #{rhs.source}"

if node.arguments.count == 2
new_arguments << ", #{node.last_argument.source}"
Expand Down