Calling let(:something) from before blocks?


I find myself repeating the same let(:something) statements over and
over again in different view examples. Therefore, I wonder if it’s
possible to define these globally in the spec_helper.rb file. I came up
with the following approach:


RSpec.configure do |config|
# …
config.before(:each, :type => :view) do
let(:something) { “available for all view examples” }
# …

However, this doesn’t work because let isn’t defined in that context:

Failure/Error: Unable to find matching line from backtrace
undefined method `let’ for

Some kind of workaround to make this work would be really nice. Is this
usage of let supported at all?

Thx & best regards,

PS: I’m using rspec 2.0.1, rails 3.0.1 and ruby 1.8.7.