Actually in steak 0.3.x (for Rails 2.x) acceptance specs are registered with the type "acceptance" so something like this should work:
config.before(:each, :type => :acceptance)
This was removed from the rails3 branch (steak 0.4.x) but I think it'd be a good idea to bring it back.
I'll do it as soon as I have some time but you know patches are always welcomed ;)
BTW, There's a related open issue:
http://github.com/cavalle/steak/issues/#issue/12
-- Luismi
Yep, that's what I meant. There used to be some code like that in steak when we created the rails3 branch.
The only thing with your snippet is that it relies on the presence of rspec-rails and while steak has always been very rails centric I try to avoid the assumption that you are testing a rails application when possible. That code can be easily rewritten without that assumption.
>> But I'm not sure how to test it in the spec folder.
> And how it tests it:
>
> http://github.com/rspec/rspec-rails/blob/master/spec/rspec/rails/example/helper_example_group_spec.rb#L21
Right. Checking for the `type` is what I had in mind to test this functionality. But, in steak, instead of doing it with a unit spec (like in the example from rspec-rails), we shall do it with an acceptance test.
I have some time this weekend so I'm gonna take care of this one.
Cheers!
-- Luismi
To do the same assertions of rspec we need to require some internals of his test suite.
Sent from my iPhone
Sent from my iPhone
http://github.com/cavalle/steak/commit/5d3a1e976caaf3ad58ff90942febb57f4cdc5f08
Now Steak sets the metadata attribute `type` to `:acceptance` so that we can include modules or set hooks just for our acceptance specs without contaminating the rest of the suite. Like this:
RSpec.configure do |config|
# include MyHelpers module in every acceptance spec
config.include MyHelpers, :type => :acceptance
config.before(:each, :type => :acceptance) do
# Some code to run before any acceptance spec
end
end
Enjoy it!
-- Luismi