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

Refactoring specs to remove warning #111

Merged
merged 2 commits into from
Feb 7, 2023
Merged

Refactoring specs to remove warning #111

merged 2 commits into from
Feb 7, 2023

Conversation

jeremyf
Copy link
Contributor

@jeremyf jeremyf commented Feb 7, 2023

Adjusting method PluggableDerivativeService implementation

e7e0675

Prior to this commit, the respond_to_missing? method definition did
not have the correct method signature. Which could cause failures
elsewhere.

Also, as much as we don't want to repeat knowledge regarding
implementation details, most references to method_missing and the
sibling respond_to_missing duplicate logic; in part to minimize
unnecessary calls. (See Always Define respond_to_missing?)

I renamed name to method_name to be consistent with the
parameters of the sibling methods.

And last, I made a change in the logic test to short-circuit faster and
not reference the file_set if we don't have "agreeable" parameters.

References:

Removing RSpec matcher warning

ba0268f

Prior to this commit the specs included the following warning:

WARNING: Using expect { }.not_to raise_error(SpecificErrorClass)
risks false positives, since literally any other error would cause the
expectation to pass, including those raised by Ruby
(e.g. NoMethodError, NameError and ArgumentError), meaning the
code you are intending to test may not even get reached. Instead
consider using expect { }.not_to raise_error or expect { }.to raise_error(DifferentSpecificErrorClass).

With this commit, we're removing that warning.

Less warnings, means less chatter.

Related to:

Prior to this commit, the `respond_to_missing?` method definition did
not have the correct method signature.  Which could cause failures
elsewhere.

Also, as much as we don't want to repeat knowledge regarding
implementation details, most references to method_missing and the
sibling respond_to_missing duplicate logic; in part to minimize
unnecessary calls.  (See [Always Define respond_to_missing?][1])

I renamed `name` to `method_name` to be consistent with the
parameters of the sibling methods.

And last, I made a change in the logic test to short-circuit faster and
not reference the file_set if we don't have "agreeable" parameters.

References:

- #43

[1]: https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding
Prior to this commit the specs included the following warning:

> WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)`
> risks false positives, since literally any other error would cause the
> expectation to pass, including those raised by Ruby
> (e.g. NoMethodError, NameError and ArgumentError), meaning the
> code you are intending to test may not even get reached. Instead
> consider using `expect { }.not_to raise_error` or `expect { }.to
> raise_error(DifferentSpecificErrorClass)`.

With this commit, we're removing that warning.

Less warnings, means less chatter.

Related to:

- #43
@jeremyf jeremyf merged commit b588a92 into main Feb 7, 2023
@jeremyf jeremyf deleted the removing-rspec-warning branch February 7, 2023 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants