-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Error when running RSpec/MatchArray #1632
Comments
Can you please provide the line of spec that the cop fails on?
|
Yes it's in my comment above. Here is the excerpt:
And here is the explanation (again from above):
|
ydah
added a commit
to ydah/rubocop-rspec
that referenced
this issue
Apr 25, 2023
5 tasks
ydah
added a commit
to ydah/rubocop-rspec
that referenced
this issue
Apr 25, 2023
ydah
added a commit
to ydah/rubocop-rspec
that referenced
this issue
Apr 25, 2023
This comment was marked as off-topic.
This comment was marked as off-topic.
ydah
added a commit
to rubocop/rubocop-rspec_rails
that referenced
this issue
Mar 27, 2024
ydah
added a commit
to rubocop/rubocop-rspec_rails
that referenced
this issue
Mar 27, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
An error is thrown when running
RSpec/MatchArray
against files in a large Rails project. For example:1 of the spec lines in question reads as follows:
expect(subject).to match_array
.Here is a backtrace:
The actual error seems to be
undefined method 'array_type?' for nil:NilClass
. The only way to stop these errors is to entirely disable the cop.It appears that this occurs when the cop inspects lines where
match_array
is called without an argument. Note that this is permissible in Rspec and the method assumes an empty array if no argument is passed. The cop should probably assume the same.Secondarily, the cop should probably recommend and auto-correct these to
be_empty
instead ofmatch_array
.The text was updated successfully, but these errors were encountered: