Sha256: ea2144df85eb3d117040d2699786a2b10d2266106ed12edef90b6f97d1f191c6

Contents?: true

Size: 1.25 KB

Versions: 21

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

class UsersControllerTest < ActionController::TestCase

  tests Headstart::UsersController

  should_filter_params :password

  context "when signed out" do
    setup { sign_out }

    context "on GET to #new" do
      setup { get :new }

      should_respond_with :success
      should_render_template :new
      should_not_set_the_flash

      should_display_a_sign_up_form
    end

    context "on GET to #new with email" do
      setup do
        @email = "a@example.com"
        get :new, :user => { :email => @email }
      end

      should "set assigned user's email" do
        assert_equal @email, assigns(:user).email
      end
    end

    context "on POST to #create with valid attributes" do
      setup do
        user_attributes = Factory.attributes_for(:user)
        post :create, :user => user_attributes
      end

      should_assign_to :user
      should_change 'User.count', :by => 1
      should_redirect_to_url_after_create
    end
  end

  signed_in_user_context do
    context "GET to new" do
      setup { get :new }
      should_redirect_to("the home page") { root_url }
    end

    context "POST to create" do
      setup { post :create, :user => {} }
      should_redirect_to("the home page") { root_url }
    end
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
headstart-0.11.2 test/controllers/users_controller_test.rb
headstart-0.11.1 test/controllers/users_controller_test.rb
headstart-0.9.2 test/controllers/users_controller_test.rb
headstart-0.9.1 test/controllers/users_controller_test.rb
headstart-0.9.0 test/controllers/users_controller_test.rb
headstart-0.8.0 test/controllers/users_controller_test.rb
headstart-0.7.0 test/controllers/users_controller_test.rb
headstart-0.6.2 test/controllers/users_controller_test.rb
headstart-0.6.1 test/controllers/users_controller_test.rb
headstart-0.6.0 test/controllers/users_controller_test.rb
headstart-0.5.5 test/controllers/users_controller_test.rb
headstart-0.5.4 test/controllers/users_controller_test.rb
headstart-0.5.3 test/controllers/users_controller_test.rb
headstart-0.5.2 test/controllers/users_controller_test.rb
headstart-0.5.1 test/controllers/users_controller_test.rb
headstart-0.5.0 test/controllers/users_controller_test.rb
headstart-0.4.2 test/controllers/users_controller_test.rb
headstart-0.4.1 test/controllers/users_controller_test.rb
headstart-0.4.0 test/controllers/users_controller_test.rb
headstart-0.3.0 test/controllers/users_controller_test.rb