Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Log Results
- 1) Error:
- test_should_get_edit(UsersControllerTest):
- ActionView::TemplateError: Called id for nil, which would mistakenly be 4 -- if
- you really wanted the id of nil, use object_id
- On line #3 of app/views/users/edit.html.erb
- 1: <h1>Editing user</h1>
- 2:
- 3: <% form_for(@user) do |f| %>
- 4: <%= f.error_messages %>
- 5:
- 6: <p>
- app/views/users/edit.html.erb:3
- /test/functional/users_controller_test.rb:29:in `test_should_get_edit'
- C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
- C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
- C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
- C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
- C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
- C:/Ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
- C:/Ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite
- '
- C:/Ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_med
- iator'
- C:/Ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
- C:/Ruby/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
- C:/Ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
- C:/Ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
- C:/Ruby/lib/ruby/1.8/test/unit.rb:278
- rake (0.8.4) lib/rake/rake_test_loader.rb:5
- ##UsersControllerTest
- test "should get edit" do
- get :edit, :id => users(:one).to_param
- assert_response :success
- end
- ##UserController
- class UsersController < ApplicationController
- def login
- @user = User.new
- @user.email = params[:email]
- end
- def process_login
- if user = User.authenticate(params[:user])
- session[:id] = user.id # Remember the user's id during this session
- redirect_to session[:return_to] || '/'
- else
- flash[:error] = 'Invalid login.'
- redirect_to :action => 'login', :email => params[:user][:email]
- end
- end
- def logout
- reset_session
- flash[:message] = 'Logged out.'
- redirect_to :action => 'login'
- end
- def my_account
- end
- end
- ##Users.yml
- one:
- id: 1
- password: MyString
- email: MyString
- ##User view
- <h1>Editing user</h1>
- <% form_for(@user) do |f| %>
- <%= f.error_messages %>
- <p>
- <%= f.label :password %><br />
- <%= f.text_field :password %>
- </p>
- <p>
- <%= f.label :email %><br />
- <%= f.text_field :email %>
- </p>
- <p>
- <%= f.submit 'Update' %>
- </p>
- <% end %>
- <%= link_to 'Show', @user %> |
- <%= link_to 'Back', users_path %>
Add Comment
Please, Sign In to add comment