Archive for the ‘Uncategorized’ Category

Small Rspec revelations, RJS

Friday, February 29th, 2008

The closing scene of this series. Specing RJS templates. Again a topic which is not on the forefront of the RSpec community.  And again a blog post saved the day. It took me a little bit of time for figure out what kind of RJS type the response object should expect. To illustrate an example RSpec:


response.should have_rjs(:chained_replace_html, "some_id") do
response.should have_text(/some random text/)
end

The response object should have an RJS object but what type? According to the assert_select_rjs method, which the have_rjs method wraps, there are only a hand full of these types but apparently not all of them are listed. As I found out when my inline RJS:


render :update do |page|
page[update_div].update(text)
end

None of the mentioned types responded correctly. But I noticed that the blog post mentioned earlier used an other type. Browsing through the source code of assert_select_rjs I found my missing type: chained_replace_html. Hooray! Everything worked fine and dandy from there on.

One last hiccup was that code in the block passed to the have_rjs method does not scope by default the response.should directive, so this is wrong:


response.should have_rjs(:chained_replace_html, "some_id") do
have_text(/some random text/)
end

Obviously.

Small Rspec revelations, Modules

Wednesday, February 27th, 2008

Small Rspec revelations, ActionMailer

Tuesday, February 26th, 2008

Building a RESTful CMS

Thursday, February 21st, 2008

The usage of self in Ruby

Tuesday, January 1st, 2008

Modules, inheritance and classes

Wednesday, December 12th, 2007

Living on the Edge

Monday, December 10th, 2007

Nested namespaces in RESTful Rails

Thursday, November 29th, 2007

attachment_fu dances with Capistrano

Tuesday, November 13th, 2007

Acts_as_versioned quirks

Sunday, November 11th, 2007