views:

93

answers:

1

Hi folks,

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 "should 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.

A: 

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?

brainfck