subject
is lazily created, per-test, and scoped to the context
/ describe
, just like let
. There shouldn't be any extra overhead to them.
I don't personally like the style you show, but I've done something similar when I have very complicated (or just big) data objects that are returned from a method.
describe "A thing" do
subject(:foo) { FactoryGirl.create(:foo) }
# A very complicated object from this method
describe "the result of calling frob" do
subject(:result) { foo.frob }
it { should be_active }
it { should be_alive }
end
end