Forum: Ruby on Rails Testing problems in Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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
in
the "unit test" of model under test/model. I used to seperate the unit
tests
and DAO tests because in unit tests we don't have to load any data into
the
database which will make unit tests faster to run. And I am willing to
unit
test controller but I haven't found a good way to do that(How can I mock
the
"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
server
and some dynamic effects are hard to test. Are there any people who can
give
me some good practices?

I have been using Java in several projects. I noticed the difference
between
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
In
Rails, I haven't seen people unit testing controllers. Is that
unnecessary
at all? Hope for answers and discussions.
This topic is locked and can not be replied to.