Sha256: 9e0d4aa8eb498a7d319137722f292c0f5adcb6094de1c5297f9e8538cb628f03

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

module Clearance
  module Test
    module Functional
      module UsersControllerTest

        def self.included(controller_test)
          controller_test.class_eval do
            
            should_filter_params :password
            
            public_context do
              context "When getting new User view" 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 "Given email parameter when getting new User view" 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 "Given valid attributes when creating a new user" do
                setup do
                  user_attributes = Factory.attributes_for(:user)
                  post :create, :user => user_attributes
                end
            
                should_create_user_successfully
              end
            end

            signed_in_user_context do
              context "GET to new" do
                setup { get :new }
                should_redirect_to "root_url"
              end

              context "POST to create" do
                setup { post :create, :user => {} }
                should_redirect_to "root_url"
              end
            end
          
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
thoughtbot-clearance-0.4.4 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.4.5 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.4.6 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.4.7 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.4.8 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.4.9 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.5.0 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.5.1 lib/clearance/test/functional/users_controller_test.rb
thoughtbot-clearance-0.5.2 lib/clearance/test/functional/users_controller_test.rb