开发者

Controller specs in isolation mode and render :update

I am using RSpec for writing my controller tests/specs.

I faced the problem, that the following code gets rendered:

render :update do |page|
  page['middle_content'].replace_html :partial => "admin/pages/show"
end

Isolation mode is the default, isn't it?

How can I fix this or am I doing something wrong?

Here is for example a failing controller spec:

it "开发者_如何学Goshould be succesful" do
  xhr :delete, :destroy, :page_id => 1, :id => 1
  response.should be_success
end

The error message:

should be succesful
Mock 'Page_1' received unexpected message :title with (no args)
On line #1 of app/views/admin/pages/_administration.html.erb

The adminitration partial gets rendered in the show partial

Best regards

EDIT: I have posted this issue to the lighthouse account of RSpec.


Maybe this will help you. If I add the following

controller.stub!(:render).and_return(nil)

everything will work(the views won't get rendered).

Does anybody of you got an idea?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜