[rspec-users] Global before block for specific spec type
Evgeniy Dolzhenko
dolzenko at gmail.com
Tue Aug 31 14:45:43 EDT 2010
So previously it seems it was possible to configure global before block which
will get run, say only for controller specs (people even used that I
think http://stackoverflow.com/questions/590100/setting-the-http-referer-in-a-global-beforeall-in-rspec/592219#592219
)
Now I wasn't able to find anything like that, and the closest thing I
came up with
is:
RSpec.configure do |config|
config.before(:all) do
if self.class.metadata[:type] == :view
# do my dirty deeds with ViewExampleGroup
end
end
end
Is that OK?
More information about the rspec-users
mailing list