I m trying to test for the presence of a form. I m new to Rails.
My new.html.erb_spec.rb
档案内容如下:
require spec_helper
describe "messages/new.html.erb" do
it "should render the form" do
render /messages/new.html.erb
reponse.should have_form_putting_to(@message)
with_submit_button
end
end
这一观点本身是新的。
<%= form_for(@message) do |f| %>
<%= f.label :msg %> <br />
<%= f.text_area :msg %>
<%= f.submit "Submit" %>
<% end %>
当我操作<代码>spec时,它未能做到:
1) messages/new.html.erb should render the form
Failure/Error: render /messages/new.html.erb
Missing partial /messages/new.html with {:handlers=>[:erb, :rjs,:builder,:rhtml, :rxml], :formats=>[:html,:text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json], :locale=>[:en, :en]} in view paths "/Users/tristanmartin/whisperme/app/views"
# ./spec/views/messages/new.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>
谁知道问题是什么?
感谢!