Mercurial > hg > soundsoftware-site
diff test/functional/.svn/text-base/account_controller_test.rb.svn-base @ 14:1d32c0a0efbf
* Update to SVN trunk (revisions 3892-4040)
author | Chris Cannam |
---|---|
date | Wed, 25 Aug 2010 16:30:24 +0100 |
parents | 513646585e45 |
children | 94944d00e43c |
line wrap: on
line diff
--- a/test/functional/.svn/text-base/account_controller_test.rb.svn-base Wed Jul 28 12:47:17 2010 +0100 +++ b/test/functional/.svn/text-base/account_controller_test.rb.svn-base Wed Aug 25 16:30:24 2010 +0100 @@ -67,6 +67,13 @@ assert_redirected_to 'my/page' end + def test_login_with_invalid_openid_provider + Setting.self_registration = '0' + Setting.openid = '1' + post :login, :openid_url => 'http;//openid.example.com/good_user' + assert_redirected_to home_url + end + def test_login_with_openid_for_existing_non_active_user Setting.self_registration = '2' Setting.openid = '1' @@ -153,4 +160,65 @@ assert_redirected_to '' assert_nil @request.session[:user_id] end + + context "GET #register" do + context "with self registration on" do + setup do + Setting.self_registration = '3' + get :register + end + + should_respond_with :success + should_render_template :register + should_assign_to :user + end + + context "with self registration off" do + setup do + Setting.self_registration = '0' + get :register + end + + should_redirect_to('/') { home_url } + end + end + + # See integration/account_test.rb for the full test + context "POST #register" do + context "with self registration on automatic" do + setup do + Setting.self_registration = '3' + post :register, :user => { + :login => 'register', + :password => 'test', + :password_confirmation => 'test', + :firstname => 'John', + :lastname => 'Doe', + :mail => 'register@example.com' + } + end + + should_respond_with :redirect + should_assign_to :user + should_redirect_to('my page') { {:controller => 'my', :action => 'account'} } + + should_create_a_new_user { User.last(:conditions => {:login => 'register'}) } + + should 'set the user status to active' do + user = User.last(:conditions => {:login => 'register'}) + assert user + assert_equal User::STATUS_ACTIVE, user.status + end + end + + context "with self registration off" do + setup do + Setting.self_registration = '0' + post :register + end + + should_redirect_to('/') { home_url } + end + end + end