开发者

RSpec-rails. The rendered method

The render开发者_开发技巧ed method in RSpec-rails' views examples is used for getting a rendered view template.

For example:

describe 'example/show.html.haml' do
  it 'displays \'ok!\'' do
    render
    rendered.should have_content('ok!')
  end
end

I'm in a difficulty in finding this method's roots. Where does it come from?

Thanks.

Debian GNU/Linux 6.0.1;

Ruby 1.9.2;

Ruby on Rails 3.1.0.rc4;

RSpec-rails 2.6.1.


It is an attr_accessor for the @rendered instance variable, which is set by the render method in ActionView::TestCase::Behavior. See https://github.com/rails/rails/blob/master/actionpack/lib/action_view/test_case.rb#L108-112.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜