Domanda

Il metodo rendered in RSpec-rails' Visto esempi viene utilizzato per ottenere un modello di vista renderizzata.

Ad esempio:

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

Sono in una difficoltà a trovare le radici di questo metodo. Da dove viene da?

Grazie.

Debian GNU / Linux 6.0.1;

Rubino 1.9.2;

Ruby on Rails 3.1.0.rc4;

RSpec-rotaie 2.6.1.

È stato utile?

Soluzione

È un attr_accessor per la variabile esempio @rendered, che è impostato dal metodo render in ActionView::TestCase::Behavior. Vedere https://github.com/ rotaie / rotaie / blob / master / actionpack / lib / action_view / test_case.rb # L108-112 .

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top