On Dec 20, 2007 4:31 AM, Bart Zonneveld <[EMAIL PROTECTED]> wrote:
> Hey gang,
>
> I have this dead-simple method defined in a helper:
>
>    def add_category_link(name)
>      link_to_function name do |page|
>        page.insert_html :bottom, :categories, :partial =>
> 'category', :object => Category.new
>      end
>    end
>
> Where, and mostly how, would I spec this? I haven't been able to find
> how to stub the rjs in a helper spec, so I'd appreciate any pointers
> whatsoever..

If you can spec it in a template using rjs, you can do it in a helper:

describe FooHelper do
  it "should build a category link" do
    add_category_link(:foo).should have_rjs(...)
  end
end

"should have_rjs" is a wrapper for assert_select_rjs in rails.

HTH,
David
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to