Forum: Ruby on Rails Testing problems in Rails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
09c7821955c74cc39b6980dd8ef8a7f0?d=identicon&s=25 Liang Huang (Guest)
on 2006-02-15 19:44
(Received via mailing list)
Hello, everyone.

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.
This topic is locked and can not be replied to.