query: tag:partial

RSpecは面白そうだったのだけれど、なかなか移行する機会が無くて使っていなかったのですが、今は縁があってRSpecでViewのテストを書いています。

で、partialのテストをする場合のメモです。

ruby>>
require File.join(File.dirname(FILE), '../../spec_helper.rb')

describe '/foos/_form.html.erb' do
before do
render :partial => 'foos/form', :object => mock('form'),
:locals => {:bar => mock('bar')}
end

it "should be rendered successfully" do
response.should be_success
end
end
<<--

とりあえずこんな感じです。

See Also

posted by genki genki on Fri 16 May 2008 at 01:23 with 1 comment