Sha256: b28238312ed974f1c549263169c76011ce985edba76edbc283135eed4bcb079d

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

module Clearance
  module Test
    module Functional
      module ConfirmationsControllerTest

        def self.included(base)
          base.class_eval do

            context 'A GET to #confirm' do
              context "with the User's given confirmation code" do
                setup do
                  @user = Factory :user
                  @user.generate_confirmation_code
                  get :confirm, :confirmation_code => @user.confirmation_code
                  @user.reload
                end

                should 'find and confirm the User record with the given confimation code' do
                  assert @user.confirmed?
                end

                should_return_from_session :user_id, "@user.id"

                should_respond_with :redirect
                should_redirect_to "@controller.send(:url_after_confirm)"
                
              end

              context "without the User's given confirmation code" do
                setup do
                  user = Factory :user
                  get :confirm, :confirmation_code => ''
                end

                should_respond_with :not_found

                should 'render nothing' do
                  assert @response.body.blank?
                end
              end
              
            end

          end
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hashrocket-clearance-0.4.0 lib/clearance/test/functional/confirmations_controller_test.rb
hashrocket-clearance-0.4.1 lib/clearance/test/functional/confirmations_controller_test.rb
hashrocket-clearance-0.4.2 lib/clearance/test/functional/confirmations_controller_test.rb
hashrocket-clearance-0.4.3 lib/clearance/test/functional/confirmations_controller_test.rb
hashrocket-clearance-0.4.4 lib/clearance/test/functional/confirmations_controller_test.rb