Ignore this, I had a different problem in my code causing this.
On Oct 5, 9:28?pm, nathanvda <nathan... at gmail.com>
wrote:> I am trying to spec my helpers, and I find a few of my helpers
> actually render a partial.
>
> My code:
>
> ? ? module PageHelper
> ? ? ? def settings_menu
> ? ? ? ? render :partial => ''_shared/settings_menu''
> ? ? ? end
>
> ? ? ? def banner_for(model)
> ? ? ? ? banner_message = ... some message ...
> ? ? ? ? render :partial => ''shared/banner'', :locals
=> { :message =>
> banner_message }
> ? ? ? end
> ? ? end
>
> I want to be able to either capture the result of the render, or just
> express the expectation that the `render` is called. For now neither
> work. My test now looks as follows:
>
> ? ? require ''spec_helper''
>
> ? ? describe PageHelper do
>
> ? ? ? context "settings_menu" do
> ? ? ? ? it "render the correct partial" do
> ? ? ? ? ? helper.should_receive(:render).with({:partial =>
''shared/
> settings_menu''})
> ? ? ? ? ? helper.settings_menu
> ? ? ? ? end
> ? ? ? ? it "generates the correct result" do
> ? ? ? ? ? @result = helper.settings_menu
> ? ? ? ? ? @result.should be == "something"
> ? ? ? ? end
> ? ? ? end
> ? ? end
>
> Both of these tests fail. The expectation is never met, and `@result`
> is always `nil`.
> _______________________________________________
> rspec-users mailing list
> rspec-us... at
rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users