Commit 4b75bdee19afb604c061fdbeef7a0af78e079e1c

Authored by AntonioTerceiro
1 parent b52026f5

ActionItem9: adding missing test



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@198 3f533792-8f58-4932-b0fe-aaf55b0a4547
test/integration/user_registers_at_the_application_test.rb 0 → 100644
... ... @@ -0,0 +1,41 @@
  1 +require "#{File.dirname(__FILE__)}/../test_helper"
  2 +
  3 +class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest
  4 + fixtures :users, :virtual_communities, :profiles
  5 +
  6 + # Replace this with your real tests.
  7 + def test_successfull_registration
  8 + get '/'
  9 + assert_tag :tag => 'div', :attributes => { :id => 'register_box' }
  10 +
  11 + get '/account/signup'
  12 + assert_response :success
  13 +
  14 + post '/account/signup', :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' }
  15 + assert_response :redirect
  16 + assert_redirected_to '/account'
  17 +
  18 + # user is logged in right after the registration
  19 + follow_redirect!
  20 + assert_no_tag :tag => 'div', :attributes => { :id => 'login_box' }
  21 + assert_tag :tag => 'div', :attributes => { :id => 'user_links' }
  22 + assert_tag :tag => 'div', :attributes => { :id => 'logout_box' }
  23 + end
  24 +
  25 + def test_trying_an_existing_login_name
  26 +
  27 + assert User.find_by_login('ze') # just to make sure that 'ze' already exists
  28 +
  29 + get '/'
  30 + assert_tag :tag => 'div', :attributes => { :id => 'register_box' }
  31 +
  32 + get '/account/signup'
  33 + assert_response :success
  34 +
  35 + post '/account/signup', :user => { :login => 'ze', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' }
  36 + assert_response :success
  37 + assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation', :class => 'errorExplanation' }
  38 +
  39 + end
  40 +
  41 +end
... ...