Sha256: 49eec3e896afb3f6835c98baafa02349a6a3a6f3c08b81d1be6d8cd6876897f0

Contents?: true

Size: 1.54 KB

Versions: 16

Compression:

Stored size: 1.54 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
require 'users_controller'

# Re-raise errors caught by the controller.
class UsersController; def rescue_action(e) raise e end; end

class UsersControllerTest < ActionController::TestCase

  def test_should_allow_signup
    assert_difference 'User.count' do
      create_user
      assert_response :redirect
    end
  end
  
  def test_should_allow_new
    get :new
    assert_response :success
  end

  def test_should_require_login_on_signup
    assert_no_difference 'User.count' do
      create_user(:login => nil)
      assert assigns(:user).errors.on(:login)
      assert_response :success
    end
  end

  def test_should_require_password_on_signup
    assert_no_difference 'User.count' do
      create_user(:password => nil)
      assert assigns(:user).errors.on(:password)
      assert_response :success
    end
  end

  def test_should_require_password_confirmation_on_signup
    assert_no_difference 'User.count' do
      create_user(:password_confirmation => nil)
      assert assigns(:user).errors.on(:password_confirmation)
      assert_response :success
    end
  end

  def test_should_require_email_on_signup
    assert_no_difference 'User.count' do
      create_user(:email => nil)
      assert assigns(:user).errors.on(:email)
      assert_response :success
    end
  end
  

  

  protected
    def create_user(options = {})
      post :create, :user => { :login => 'quire', :email => 'quire@example.com',
        :password => 'quire69', :password_confirmation => 'quire69' }.merge(options)
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
branston-0.6.1 lib/branston/test/functional/users_controller_test.rb
branston-0.6.0 lib/branston/test/functional/users_controller_test.rb
branston-0.5.2 lib/branston/test/functional/users_controller_test.rb
branston-0.5.1 lib/branston/test/functional/users_controller_test.rb
branston-0.5.0 lib/branston/test/functional/users_controller_test.rb
branston-0.4.6 lib/branston/test/functional/users_controller_test.rb
branston-0.4.5 lib/branston/test/functional/users_controller_test.rb
branston-0.4.4 lib/branston/test/functional/users_controller_test.rb
branston-0.4.3 lib/branston/test/functional/users_controller_test.rb
branston-0.4.2 lib/branston/test/functional/users_controller_test.rb
branston-0.4.1 lib/branston/test/functional/users_controller_test.rb
branston-0.4.0 lib/branston/test/functional/users_controller_test.rb
branston-0.3.6 lib/branston/test/functional/users_controller_test.rb
branston-0.3.4 lib/branston/test/functional/users_controller_test.rb
branston-0.3.3 lib/branston/test/functional/users_controller_test.rb
branston-0.3.2 lib/branston/test/functional/users_controller_test.rb