-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allows metadata to override the type of Rails spec #807
Conversation
c.include RSpec::Rails::ControllerExampleGroup, | ||
:type => :controller, | ||
:example_group => lambda { |example_group, metadata| | ||
metadata[:type].nil? && c.escaped_path(%w[spec controllers]) =~ example_group[:file_path] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about something like this:
def c.match_example_group_by_path(path)
lambda { |example_group, metadata|
metadata[:type].nil? && escaped_path(path) =~ example_group[:file_path]
}
end
c.include RSpec::Rails::ControllerExampleGroup,
:type => :controller,
:example_group => c.match_example_group_by_path(%w[spec controllers])
Really good job documenting the magic directories w/cucumber 🍰 |
Do we know why the build is failing on this? I started tackling this from the opposite end but this is a better approach. I suspect @alindeman will be too busy to look at this this week though... |
Needs restarting once the |
This reverts commit 427983a. This syntax is not supported on Ruby 1.8.7 Conflicts: lib/rspec/rails/example.rb
No idea, it's been a while but maybe protecting against not being given metadata in some scenarios? |
Allows metadata to override the type of Rails spec
🆒 I think rspec-core's arity checking will make sure this holds up OK, but if you know of a specific circumstance it breaks down, let me know :) |
[Fixes #801]