[rspec-users] How to expect no layout

Fernando Perez lists at ruby-forum.com
Tue Nov 11 05:46:19 EST 2008


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})
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list