Sha256: 494f42a99eb91b4cd47307a706f1ec00e7ec028fa8d0a7e0626275dc10890e9d

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

class UsersControllerTest < ActionController::TestCase

  tests BlueLightSpecial::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

5 entries across 5 versions & 3 rubygems

Version Path
cops-0.2.0.7 test/controllers/users_controller_test.rb
blue_light_special-0.2.1 test/controllers/users_controller_test.rb
cops-0.2.0.6 test/controllers/users_controller_test.rb
blue_light_special_heroku_fork-0.2.0.1 test/controllers/users_controller_test.rb
blue_light_special-0.2.0 test/controllers/users_controller_test.rb