I start using Rails to develop a little project and I have some concerns
while I’m practising TDD.
In rails, it seems very common to functional testing contoller without
unit testing it, and the unit tests and DAO tests of models are mingled
the “unit test” of model under test/model. I used to seperate the unit
and DAO tests because in unit tests we don’t have to load any data into
database which will make unit tests faster to run. And I am willing to
test controller but I haven’t found a good way to do that(How can I mock
“render” method?). Does anybody have good ideas?
Are the functional tests of controllers enough? I don’t think so
personally. I think we still need functional tests of them. Selenium and
watir help us in this area. I wonder if and how other people use them.
The last question is about testing ajax. Asyncronous call to the
and some dynamic effects are hard to test. Are there any people who can
me some good practices?
I have been using Java in several projects. I noticed the difference
Java and Ruby and I like them both very much. In Java, mock objects are
widespreadly used in unit tests of domain objects and controllers, but
Rails, I haven’t seen people unit testing controllers. Is that
at all? Hope for answers and discussions.