On Monday, March 24, 2014 7:53:56 AM UTC-7, Jonathan Greenberg wrote:
>
> I am wondering if there is an existing syntax for not running a hook in
> specs of a certain type. For example:
>
> config.before(not_type: :feature) do
> this_would_blow_up_a_feature_spec
> end
>
> I have not found anything like this in the documentation but I could
> easily be overlooking.
>
> Thanks!
>
You can do this:
RSpec.configure do |config|
config.before(:each) do |ex|
unless ex.metadata[:type] == :feature
this_would_blow_up_a_feature_spec
end
end
end
That assumes you are on 2.99 or 3.0. If you're on an earlier version,
remove the block `ex` args and use `example.metadata` instead of
`ex.metadata`.
HTH,
Myron
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/bb58c85e-517a-4c11-a743-c0386ee8cf52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.