[rspec-users] Common setup code and naming specifications
Tobias Grimm
listaccount at e-tobi.net
Thu Jan 4 18:03:36 EST 2007
Hello!
I have a lot of contexts for testing Rails controllers, that must do
something like 'session[:logged_in] = true' in their setup. How can this
be refactored? In unit tests I would simply create a
LoggedInControllerTest base class, that all my functional tests would
derive from.
And another small question:
In my controller specifications I often have to decide whether to write:
specify "should provide the first ten items in @items and three pages in
@pages when passing no :page parameter to the :list action"
or
specify "should provide the first ten items and three pages when not
selecting a specific page"
So the decision is, whether to explicitly name parameters, return values
and actions or to use a more abstract phrase. How do you handle this?
Sorry, might be a stupid question, but I'm, still trying to get the
right "feeling" for BDD-style testing.
bye,
Tobias
More information about the rspec-users
mailing list