>
> > Use before(:all) where possible, you've already mentioned this.
>
> This is the first thing I'm trying to do. Existing "scenarios" (some
> methods on a class that get called to create a set of models (users,
> etc.) are creating models with specific names or IDs, which some tests
> rely on, and thus subsequent runs are failing (duplicate id or name...
> before :all doesn't clear the db after each run, which makes sense...
> it's before :all)
>
You can also use `let` (which some Lisp folk might recognise) for
values that are used some of the time, but not in every test block. It
appears to be evaluated only when called for in each block.
For example:
describe MyThingy do
let(:a) { make_me_an_a }
it "should test this" do
a.should be_valid
end
it "should test that" do
a.should_not be_invalid
end
it "should not test this or that" do
make_me_a_b.should be_valid
end
end
This example only calls the let block twice because the `a` variable
is used in two tests.
Bayan
--
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.