I am using Rails 2.3.4 and Rspec 1.2.0. I m trying to test a helper that attempts to render a page or a partial, I'm getting an exception as
undefined method `render' for
Assume, my helper method is
def some_helper
render(:partial => "some/partial", :locals => {:some => some}
end
and calling it from spec as
it "should render the partial" do
some_helper.should render_template("some/partial")
end
Any suggestion would be useful
What about:
it "should render the partial" do
helper.should_receive("render").with("some/partial")
some_helper
end
UPDATE
When you use the new expectation syntax I would do
it "renders the partial" do
allow(helper).to receive(:render)
some_helper
expect(helper).to have_received(:render).with("some/partial")
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With