On Mon, Apr 20, 2009 at 1:26 PM, Michael Schuerig <[email protected]> wrote: > On Monday 20 April 2009, Pat Maddox 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. 1. Write failing acceptance test 2. Drill down, write failing unit tests 3. Make unit tests pass. Go to 2 until 4. Acceptance test passes, go to the pub In this case, you would 1. Write failing acceptance test 2. Realize that the code you're writing is not unit testable 3. Unit test other parts of code 4. 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 _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
