Global before block for specific spec type

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

)

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?

On Aug 31, 2010, at 1:45 PM, Evgeniy D. wrote:

config.before(:all) do
if self.class.metadata[:type] == :view
# do my dirty deeds with ViewExampleGroup
end
end
end

Is that OK?

Better to do this:

RSpec.configure do |config|
config.before(:all, :type => :view) do
# do stuff
end
end