Skip to content

Instantly share code, notes, and snippets.

@rhysforyou
Created November 28, 2011 01:10
Show Gist options
  • Select an option

  • Save rhysforyou/1398661 to your computer and use it in GitHub Desktop.

Select an option

Save rhysforyou/1398661 to your computer and use it in GitHub Desktop.
› rake spec cucumber
/Users/rpowell93/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec ./spec/controllers/books_controller_spec.rb ./spec/helpers/books_helper_spec.rb ./spec/models/book_spec.rb ./spec/views/books/new.html.erb_spec.rb
..F
Failures:
1) books/new.html.erb should render a form to add a new book
Failure/Error: render
ActionView::Template::Error:
No input found for Book_#<RSpec::Core::ExampleGroup::Nested_3:0x007fedfdb83510>
# ./app/views/books/new.html.erb:4:in `block in _app_views_books_new_html_erb___2832296693760024294_70330069700200'
# ./app/views/books/new.html.erb:3:in `_app_views_books_new_html_erb___2832296693760024294_70330069700200'
# ./spec/views/books/new.html.erb_spec.rb:9:in `block (2 levels) in <top (required)>'
Finished in 3.18 seconds
3 examples, 1 failure
Failed examples:
rspec ./spec/views/books/new.html.erb_spec.rb:8 # books/new.html.erb should render a form to add a new book
rake aborted!
ruby /Users/rpowell93/.rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec ./spec/controllers/books_controller_spec.rb ./spec/helpers/books_helper_spec.rb ./spec/models/book_spec.rb ./spec/views/books/new.html.erb_spec.rb failed
Tasks: TOP => spec
(See full trace by running task with --trace)
<h1>Books#new</h1>
<%= simple_form_for @book do |f| %>
<%= f.input :title %>
<%= f.input :author %>
<%= f.button :submit, "Add book" %>
<% end %>
require 'spec_helper'
describe "books/new.html.erb" do
before :each do
@book = mock_model("Book").as_null_object
end
it "should render a form to add a new book" do
render
rendered.should have_selector("form[method=post]", :action => books_path)
rendered.should have_selector("input[type=text]#book_title")
rendered.should have_selector("input[type=text]#book_author")
rendered.should have_selector("input[type=submit]")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment