On Jul 11, 2008, at 1:04 PM, Reggie Mr. wrote:

Hi all,

I'm having trouble with rspec 1.1.4 and rjs

response.should have_rjs   #this should be successful for any rjs
request; but fails

response.should have_rjs(:replace_html)  #no luck

I have tried mocking the page object, but that also fails.

e.g
@page = mock('page)
@page.should_receive(:replace_html)

What's the best practice to validate rjs responses?

I use the ARTS plugin to validate RJS. (http://github.com/richpoirier/arts/tree/master )
After you install it, you can do things like:

    it "should render edit template" do
      do_get

      assert_rjs :page, 'error_div', :hide
      assert_rjs :replace_html, "edit_div"
      assert_rjs :visual_effect, :scroll_to, 'edit_div'
      assert_rjs :visual_effect, :highlight, "[EMAIL PROTECTED]"
    end

Hope this helps!

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to