-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Suggestion: Check for constants being defined in specs #197
Comments
Would this cop encourage using |
I don’t know. In most cases you could probably just use local variables – e.g. foo = Class.new do
def self.bar
1
end
end
puts foo.bar
#=> 1 but we should probably allow using |
Sounds like a good idea |
This is a tricky one to get right but seems like a good idea |
Here’s a @kmayer blog post on the issue http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html |
As mentioned here rubocop#765 (comment), it's not even necessary in some cases to stub a constant, a so-called "sacrificial class" will do. Originally mentioned article http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html in this comment rubocop#197 (comment)
As mentioned here rubocop#765 (comment), it's not even necessary in some cases to stub a constant, a so-called "sacrificial class" will do. Originally mentioned article http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html in this comment rubocop#197 (comment)
As mentioned here rubocop#765 (comment), it's not even necessary in some cases to stub a constant, a so-called "sacrificial class" will do. Originally mentioned article http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html in this comment rubocop#197 (comment)
As mentioned here rubocop#765 (comment), it's not even necessary in some cases to stub a constant, a so-called "sacrificial class" will do. Originally mentioned article http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html in this comment rubocop#197 (comment)
As mentioned here rubocop#765 (comment), it's not even necessary in some cases to stub a constant, a so-called "sacrificial class" will do. Originally mentioned article http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html in this comment rubocop#197 (comment)
As mentioned here rubocop#765 (comment), it's not even necessary in some cases to stub a constant, a so-called "sacrificial class" will do. Originally mentioned article http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html in this comment rubocop#197 (comment)
As mentioned here rubocop#765 (comment), it's not even necessary in some cases to stub a constant, a so-called "sacrificial class" will do. Originally mentioned article http://blog.bitwrangler.com/2016/11/10/sacrificial-test-classes.html in this comment rubocop#197 (comment)
When you define a constant (modules, classes, constants) in a spec, it’s defined in global scope. That may lead to confusing spec errors:
With the output
The text was updated successfully, but these errors were encountered: