On 2008-11-11, at 05:46, Fernando Perez wrote:
Nick Hoffman wrote:
Hey guys. I've told one of my controllers to not render a layout for a
certain action:
  layout false, :only => :map_info_window

Now I'm trying to spec that, but this:
  it 'should not render a layout' do
    controller.expect_render :layout
    do_get
  end

fails with this:
  Spec::Mocks::MockExpectationError in 'PropertiesController handling
GET /properties/1/map_info_window should not render a layout'
Mock 'expect_render_mock_proxy' expected :render with (:layout) once,
but received it 0 times

I'm using RSpec v1.1.4 . I know it's old, but I haven't gotten around
to upgrading yet!
-Nick

Try:
controller.should_receive(:layout).with(false, {:only =>
:map_info_window})

Hi Fernando. Unfortunately, that didn't work either. It seems that the controller object in the "controller" variable doesn't actually receive the call to #layout :

Spec::Mocks::MockExpectationError in 'PropertiesController handling GET /properties/1/map_info_window should not render a layout' Mock 'PropertiesController' expected :layout with (false, {:only=>:map_info_window}) once, but received it 0 times

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

Reply via email to