Skip to content

Instantly share code, notes, and snippets.

@jeromegn
Created April 26, 2009 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromegn/102052 to your computer and use it in GitHub Desktop.
Save jeromegn/102052 to your computer and use it in GitHub Desktop.
<%= form.label :name %><br />
<%= form.text_field :name %><br />
<br />
<%= form.label :website %><br />
<%= form.text_field :website %><br />
<br />
<%= form.label :bio %><br />
<%= form.text_area :bio %><br />
<br />
<%= form.label :email %><br />
<%= form.text_field :email %><br />
<br />
<%= form.label :password, form.object.new_record? ? nil : "Change password" %><br />
<%= form.password_field :password %><br />
<br />
<%= form.label :password_confirmation %><br />
<%= form.password_field :password_confirmation %><br />
1)
ActionView::TemplateError in '/users/new.html.erb renders registration form'
undefined method `errors' for #<Object:0x2fd0b18>
On line #4 of app/views/users/new.html.erb
1: <h1>Register</h1>
2:
3: <% form_for @user, :url => account_path do |f| %>
4: <%= f.error_messages %>
5: <%= render :partial => "form", :object => f %>
6: <%= f.submit "Register" %>
7: <% end %>
app/views/users/new.html.erb:4
app/views/users/new.html.erb:3
/Users/jgn/.gem/ruby/1.8/gems/rspec-rails-1.2.4/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
/Users/jgn/.gem/ruby/1.8/gems/rspec-rails-1.2.4/lib/spec/rails/example/view_example_group.rb:157:in `__send__'
/Users/jgn/.gem/ruby/1.8/gems/rspec-rails-1.2.4/lib/spec/rails/example/view_example_group.rb:157:in `render'
/spec/views/users/new.html.erb_spec.rb:11
rspec (1.2.4) lib/spec/example/example_methods.rb:41:in `instance_eval'
rspec (1.2.4) lib/spec/example/example_methods.rb:41:in `execute'
/opt/ruby-enterprise-1.8.6-20090201/lib/ruby/1.8/timeout.rb:53:in `timeout'
rspec (1.2.4) lib/spec/example/example_methods.rb:38:in `execute'
rspec (1.2.4) lib/spec/example/example_group_methods.rb:203:in `run_examples'
rspec (1.2.4) lib/spec/example/example_group_methods.rb:201:in `each'
rspec (1.2.4) lib/spec/example/example_group_methods.rb:201:in `run_examples'
rspec (1.2.4) lib/spec/example/example_group_methods.rb:99:in `run'
rspec (1.2.4) lib/spec/runner/example_group_runner.rb:23:in `run'
rspec (1.2.4) lib/spec/runner/example_group_runner.rb:22:in `each'
rspec (1.2.4) lib/spec/runner/example_group_runner.rb:22:in `run'
rspec (1.2.4) lib/spec/runner/options.rb:119:in `run_examples'
rspec (1.2.4) lib/spec/runner/command_line.rb:9:in `run'
rspec (1.2.4) bin/spec:4
Finished in 0.308878 seconds
23 examples, 1 failure
<h1>Register</h1>
<% form_for @user, :url => account_path do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Register" %>
<% end %>
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
describe "/users/new.html.erb" do
include UsersHelper
before(:each) do
assigns[:user] = Factory.stub(:user)
end
it "renders registration form" do
render
response.should have_tag("form[action=?][method=post]", account_path) do
with_tag("input#user_name[name=?]", "user[name]")
with_tag("input#user_website[name=?]", "user[website]")
with_tag("textarea#user_bio[name=?]", "user[bio]")
with_tag("input#user_email[name=?]", "user[email]")
with_tag("input#user_password[name=?]", "user[password]")
with_tag("input#user_password_confirmation[name=?]", "user[password_confirmation]")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment