> Proper usage, sure, but the memoization is only within each example - not
> across examples. That way you can do this:
>
> let(:thing) { Thing.new }
>
> it "does something" do
> thing.blah
> thing.whatever
> thing.yet_again
> end
>
> In that case each reference to thing returns the same object.
>
> Make sense?
Hmm.. now I am confused...
What is the difference between:
describe "Foo" do
let(:foo) { Foo.new }
it "is tubular" do
foo.bar
foo.baz
end
it "is gnarly" do
foo.gnarl
foo.wurd_up
end
end
vs.
describe "Foo" do
before :each do
@foo = Foo.new
end
it "seems just as tubular as the foo w/ let" do
@foo.bar
@foo.baz
end
it "seems just as gnarly as the foo w/ let" do
foo.gnarl
foo.wurd_up
end
end
I am not seeing any difference...?
Patrick J. Collins
http://collinatorstudios.com
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users