|
Red Squirrel Reflections
Dave Hoover explores the psychology of software development
|
|
Tue, 22 Aug 2006Rails Integration Testing redirect_to :back ActionController provies some ultra-convenient functionality via redirect_to :back. To get it to work in your Controller and Integration tests, you'll need to make sure that the HTTP_REFERER is set on the request. This is fairly straightforward for Controller tests:
@request.env["HTTP_REFERER"] = "/babies/new"
get :create, :baby => { ... }
assert_redirected_to "babies/new"
For Integration tests, it's a little different:
get "babies/create", { :baby => { ... } }, { "HTTP_REFERER" => "/babies/new" }
assert_redirected_to "babies/new"
Unfortunately, this Integration test will fail. There is a bug in ActionController::Integration::Session (patched here) which can be worked around if you change the header to 'REFERER' => "/babies/new" or :referer => "/babies/new".
George provided an insightful post on Java and the trend toward dynamic languages:
I'd like to see focus shifted to the core characteristics of Java that made it such an interesting prospect at first, and these, in my opinion, boil down to good software design, powered by fundamental OO principles, not bells and whistles like Continuations, which, according to the Ruby FAQ, can be used to implement complex control structures, but are typically more useful as ways of confusing people. |