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
Allow more lines on scenario examples #210
Comments
I'd be open to something like that (ideally not a totally new cop). I don't use scenarios so I probably wont implement that in my free time but if you want to propose a specific implementation solution I'd be fine with accepting a PR for this |
If one would like to implement this, where would you start? |
This issue also concerns |
This is actually an issue for many of our cops (and I haven't been sure how to improve rubocop-rspec to fit the various use cases) so how do you feel about something like this: ---
AllCops:
RSpec:
Patterns:
- _spec.rb
- "(?:^|/)spec/"
SpecTypes:
Feature: 'spec/features/**/*'
Unit: 'spec/unit/**/*'
Scenario: 'spec/scenario/**/*'
# ...
RSpec/ExampleLength:
Description: Checks for long examples.
Enabled: true
Max: 5
SpecType:
Feature:
Max: 10
Scenario:
Max: 10 The idea here is that you could specify any arbitrary mapping of a spec type name to a file glob in the @ehannes @bquorning @andyw8 thoughts on this approach? |
As I recall it, I realize that not all people use RSpec together with Rails, so perhaps this is a bad suggestion. |
@bquorning Good point. It's true that |
You can add metadata based on directory structure using I guess the question is whether we want to force part of the configuration into people’s |
I tried the following: # spec/support/integration_helper.rb
module IntegrationHelper
# Includes things that integration tests need
end # spec/integrations/test_class_spec.rb
describe TestClass, type: :integration do
# Some examples that need IntegrationHelper
end # spec/spec_helper.rb
RSpec.configure do |config|
# ...
config.include IntegrationHelper, type: :integration
# ...
end And it works like a charm. |
I would rather add |
If you use
|
I'd rather just define the globs. It would be extremely hard to statically determine the types for different specs. |
@backus With globs, do you mean the approach you proposed at first, or the approach @bquorning suggested (using the |
@ehannes the explicit globs in the config file. IMO we couldn't reliably know what the different spec types are without loading the user's rspec environment and this gem is not in the business of dynamic analysis |
I found a new feature in RSpec 3.3 today: |
Yeah I added #233 for that reason |
Should we move this issue from "Discussion" to "Enhancement"? "Explicit globs" seems like the way to go. |
Sure! |
I, too, would love this. Feature/Integration specs tend to be much longer so it forces you to either disable the 👮 altogether or bump up the |
I know I can set the allowed length of examples with:
Would it be possible to implement a specific limit to scenario examples (those examples used in feature specs)? For performance reason, especially when testing JavaScript, I tend to allow more than one example per scenario. Something like this:
The text was updated successfully, but these errors were encountered: