Skip to content

Instantly share code, notes, and snippets.

@amuino
Created August 26, 2010 12:25
Show Gist options
  • Save amuino/551303 to your computer and use it in GitHub Desktop.
Save amuino/551303 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/../test_helper'
require 'signup_controller'
# Re-raise errors caught by the controller.
class SignupController; def rescue_action(e) raise e end; end
#
# Adivinen pq falla el assert_not_nil current_user, cuando no debería :-)
#
class SignupControllerTest < ActionController::TestCase
def test_user_is_created_after_start
assert_difference "User.count" do
post :do_start, :user => { :login => "a_new_user", :password => "passwd", :password_confirmation => "passwd",
:email => "a_new_user@example.com", :gender_id => Gender.find_by_name("male").id.to_s }
assert_not_nil assigns(:user)
assert assigns(:user).errors.empty?
assert_response :redirect
assert_redirected_to :action => :profile
current_user = @controller.instance_exec { current_user }
assert_not_nil current_user
assert_equal current_user, assigns(:user)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment