On Mon, Apr 20, 2009 at 1:26 PM, Michael S. [email protected]
wrote:
On Monday 20 April 2009, Pat M. wrote:
In a functional test, create some records that will be in the scope
and some that will be out of the scope, hit the page and make sure
you only see the ones that you want. I would either do this with
cucumber, or write a controller spec and verify that only certain
records show in the the assigns var. Either way you’re going to have
to hit the db because obviously the scope affects the db queries.Yes, and that feels a bit like cheating.
What feels like cheating, and why?
Look at the BDD process again.
- Write failing acceptance test
- Drill down, write failing unit tests
- Make unit tests pass. Go to 2 until
- Acceptance test passes, go to the pub
In this case, you would
- Write failing acceptance test
- Realize that the code you’re writing is not unit testable
- Unit test other parts of code
- Acceptance test passes, go to the pub
This is why you’d typically like to keep that stuff in the model.
I agree on the typically, but disagree specifically.
Agreed, which is why I gave a solution instead of just saying to put
it in the model.
Pat