Phil Pirozhkov
Phil Pirozhkov
@marcandre Yes, I have seen this PR was merged. Awesome. From the description: > makes it easier to understand which methods are private It should be easy enough if the...
@AlexWayfer Here you go! ```ruby module BaseSpecHelper module_function def environment_specs_coefficients 1 end end module CLISpecHelper extend BaseSpecHelper module_function def environment_specs_coefficients super + 1 end end ``` ```ruby BaseSpecHelper.environment_specs_coefficients # =>...
@marcandre ``` Anything.new.environment_specs_coefficients NoMethodError: private method `environment_specs_coefficients' called for # ``` and this is intentional. `environment_specs_coefficients` is intended to be called on `CLISpecHelper`/`BaseSpecHelper`, **not to be included**. Just tested on...
Magnificent explanation! As a practical experiment I've replaced all `alias` with `alias_method` in `rspec-mocks`'s source code, and specs passed just fine.
> Only omit parentheses for...Methods that are part of an internal DSL (e.g., Rake, Rails, RSpec) I'd relax this rule to "Always use parentheses for ... methods that are NOT...
[`NotImplementedError`](https://ruby-doc.org/core-3.0.0/NotImplementedError.html): > Raised when a feature is not implemented on the current platform. For example, methods depending on the `fsync` or `fork` system calls may raise this [`NoMethodError`](https://ruby-doc.org/core-3.0.0/NoMethodError.html): > Raised...
I've grepped through [`real-world-rspec`](https://github.com/pirj/real-world-rspec) for `(raise|fail) NoMethodError` and `(raise|fail) NotImplementedError`, and there are approximately 861 usages of `NotImplementedError` versus 23 usages of `NoMethodError`. I encourage someone with more free disk...
There is this https://github.com/rubocop-hq/ruby-style-guide#nested-ternary-operators > Use one expression per branch in a ternary operator Is it sufficient to clarify that an "expression" should not have side effects? (see https://en.wikipedia.org/wiki/Expression_(computer_science)#Side_effects_and_elimination) However,...
I understand that `->` is a first-class citizen and it's not a method call. However, it hit me by surprise that ```ruby Math.log(10).floor # => 2 Math.log (10).floor # =>...
We have https://github.com/rubocop-hq/ruby-style-guide/#optional-arguments > Define optional arguments at the end of the list of arguments. > This is an invalid Ruby code. Indeed, but: ```ruby def foo(a, b=42, c) #...