vendor/gems/flexmock-0.8.5/lib/flexmock/rails/view_mocking.rb
# This version of should_render_view will work with versions of
# Rails at Version 2.2.x.
This version of should_render_view will work with versions of
Rails at Version 2.2.x.
This version of should_render_view will work with versions of Rails at Version 2 . 2 . x .
def should_render_view_22x(template_name)
      viewmock = flexmock("ViewMock")
      viewmock.should_receive(
        :helpers => viewmock,
        :include => nil,
        :template_format =>nil,
        :render => "RENDERED TEXT",
        :assigns => {})
      if template_name
        viewmock.should_receive(:_exempt_from_layout?).with(/\/#{template_name}$/).
          and_return(true).once
        viewmock.should_receive(:_exempt_from_layout?).and_return(true)
      else
        viewmock.should_receive(:_exempt_from_layout?).at_least.once.and_return(true)
      end
      flexmock(ActionView::Base).should_receive(:new).and_return(viewmock)
    end
def should_render_view_22x ( template_name ) viewmock = flexmock ( "ViewMock" ) viewmock . should_receive ( :helpers => viewmock , :include => nil , :template_format => nil , :render => "RENDERED TEXT" , :assigns => { } ) if template_name viewmock . should_receive ( :_exempt_from_layout? ) . with ( / \/ #{ template_name } $ / ) . and_return ( true ) . once viewmock . should_receive ( :_exempt_from_layout? ) . and_return ( true ) else viewmock . should_receive ( :_exempt_from_layout? ) . at_least . once . and_return ( true ) end flexmock ( ActionView :: Base ) . should_receive ( :new ) . and_return ( viewmock ) end
This version of should_render_view will work with versions of
Rails at Version 2.2.x.
This version of should_render_view will work with versions of Rails at Version 2 . 2 . x .
template_name