[rspec-users] specifying output of render call
pergesu at gmail.com
Mon May 5 22:47:27 EDT 2008
One problem with rjs is that it's very difficult to test. You can't
execute it, and executing code is necessary for specification by
In this case, I would probably not unit test that code, based on the
combination of it being simple code but difficult to test. I would
probably right a "ping" test though, that just makes the request and
asserts an ok response. That at least covers syntax errors or bad
method calls. You could write a selenium test if you want I suppose.
My current favorite pattern for RJS-type stuff is to push the behavior
into the client and have the server just render JSON. This makes it
very easy to test the behavior using jspec, and leaves you with a very
natural separation of concerns.
More information about the rspec-users