From 4b75bdee19afb604c061fdbeef7a0af78e079e1c Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 27 Jul 2007 19:58:07 +0000 Subject: [PATCH] ActionItem9: adding missing test --- test/integration/user_registers_at_the_application_test.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+), 0 deletions(-) create mode 100644 test/integration/user_registers_at_the_application_test.rb diff --git a/test/integration/user_registers_at_the_application_test.rb b/test/integration/user_registers_at_the_application_test.rb new file mode 100644 index 0000000..7d9fdb7 --- /dev/null +++ b/test/integration/user_registers_at_the_application_test.rb @@ -0,0 +1,41 @@ +require "#{File.dirname(__FILE__)}/../test_helper" + +class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest + fixtures :users, :virtual_communities, :profiles + + # Replace this with your real tests. + def test_successfull_registration + get '/' + assert_tag :tag => 'div', :attributes => { :id => 'register_box' } + + get '/account/signup' + assert_response :success + + post '/account/signup', :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' } + assert_response :redirect + assert_redirected_to '/account' + + # user is logged in right after the registration + follow_redirect! + assert_no_tag :tag => 'div', :attributes => { :id => 'login_box' } + assert_tag :tag => 'div', :attributes => { :id => 'user_links' } + assert_tag :tag => 'div', :attributes => { :id => 'logout_box' } + end + + def test_trying_an_existing_login_name + + assert User.find_by_login('ze') # just to make sure that 'ze' already exists + + get '/' + assert_tag :tag => 'div', :attributes => { :id => 'register_box' } + + get '/account/signup' + assert_response :success + + post '/account/signup', :user => { :login => 'ze', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' } + assert_response :success + assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation', :class => 'errorExplanation' } + + end + +end -- libgit2 0.21.2