« Return to Thread: testing behaviour or testing code?

Re: testing behaviour or testing code?

by Hans de Graaff :: Rate this Message:

Reply to Author | View in Thread

On Sat, 2007-08-25 at 00:01 -0700, David Green wrote:

> I wasn't testing my views at all, instead relying on integrate_views to
> catch any problems. This time round I wrote view specs, which is a little
> more work but testing only one MVC aspect in isolation really makes things
> simpler. I realise now that the old way, I was using controller specs to
> test integration rather than controllers.

I'm actually doing a bit of both. I write all my controller specs
without integrate_views, with separate specs for the views. On top of
that I'm also including very simple specs for each action in the
controller including views and relying on fixtures, mostly like this:

it 'should be a valid page' do
  get :index
  response.should be_xhtml
end

Even though all the behaviour is tested without views and fixtures, this
additional check helps to find problems in the interaction between
views, controller, and model, and it is the only way I know to validate
the pages as XHTML.

Kind regards,

Hans


_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

signature.asc (196 bytes) Download Attachment

 « Return to Thread: testing behaviour or testing code?