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

Error with Minitest/AssertOutput when global assignment occurs at top level #106

Closed
mvz opened this issue Jul 17, 2020 · 2 comments · Fixed by #107
Closed

Error with Minitest/AssertOutput when global assignment occurs at top level #106

mvz opened this issue Jul 17, 2020 · 2 comments · Fixed by #107
Labels
bug Something isn't working

Comments

@mvz
Copy link

mvz commented Jul 17, 2020

If a file under test/ contains an assignment to a global variable at the top level, Minitest/AssertOutput will generate an error

Expected behavior

Minitest/AssertOutput ignores the assignment because it doesn't occur in a test case

Actual behavior

RuboCop generates an error message like the following:

An error occurred while Minitest/AssertOutput cop was inspecting /home/matijs/Projects/gir_ffi/test/foo.rb:1:0

Steps to reproduce the problem

Given a project configured for using rubocop-minitest, create a file test/foo.rb containing

$VERBOSE = false

Then run:

$ rubocop test/foo.rb

RuboCop version

0.88.0 (using Parser 2.7.1.4, rubocop-ast 0.1.0, running on ruby 2.7.1 x86_64-linux)
@koic koic added the bug Something isn't working label Jul 17, 2020
koic added a commit to koic/rubocop-minitest that referenced this issue Jul 17, 2020
Fixes rubocop#106.

This PR fixes an error for `Minitest/AssertOutput` when using gvar at top level.
@koic koic closed this as completed in #107 Jul 18, 2020
koic added a commit that referenced this issue Jul 18, 2020
[Fix #106] Fix an errof for `Minitest/AssertOutput` cop
@mvz
Copy link
Author

mvz commented Jul 20, 2020

Thanks, @koic!

@koic
Copy link
Member

koic commented Jul 20, 2020

@mvz You are welcome :-) Thank you for feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants