Created
October 7, 2010 17:00
-
-
Save don-smith/615455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/views/talks/_form.html.erb | |
<%= form_for([@event, @talk]) do |f| %> | |
<% if @talk.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@talk.errors.count, "error") %> prohibited this talk from being saved:</h2> | |
<ul> | |
<% @talk.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> | |
</div> | |
<% end %> | |
<div class="field"> | |
<%= f.label :title %><br /> | |
<%= f.text_field :title %> | |
</div> | |
<div class="field"> | |
<%= f.label :abstract %><br /> | |
<%= f.text_area :abstract %> | |
</div> | |
<div class="field"> | |
<%= f.label :level %><br /> | |
<%= f.text_field :level %> | |
</div> | |
<div class="actions"> | |
<%= f.submit %> | |
</div> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Need to include once I can 'bundle install' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/views/talks/new.html.erb_spec.rb | |
require 'spec_helper' | |
describe 'talks/new.html.erb' do | |
before(:each) do | |
assign(:talk, stub_model(Talk, | |
:new_record? => true, | |
:event_id => 12 | |
)) | |
view.stub!(:event_talks_path).and_return {'/events/12/talks'} | |
end | |
it 'renders new talk form' do | |
render | |
rendered.should have_selector('form', :action => talks_path, :method => 'post') do |form| | |
form.should have_selector('input#talk_title', :name => 'talk[title]') | |
form.should have_selector('textarea#talk_abstract', :name => 'talk[abstract]') | |
form.should have_selector('input#talk_level', :name => 'talk[level]') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think it matters, but I am using the 0.7.2.pre branch of webrat at http://github.com/kalv/webrat.git