Sha256: 886715e261576cc8659e1d11e4c6afd209cb8d767620e3636f93069289a7888c

Contents?: true

Size: 911 Bytes

Versions: 34

Compression:

Stored size: 911 Bytes

Contents

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

class AuthenticationTest < ActionDispatch::IntegrationTest
  
  def test_get_with_unauthorized_access
    assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.authentication
    get '/cms-admin/pages'
    assert_response :unauthorized
    get '/'
    assert_response :success
  end
  
  def test_get_with_authorized_access
    http_auth :get, '/cms-admin/pages'
    assert_response :success
  end
  
  def test_get_with_changed_default_config
    assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.authentication
    ComfortableMexicanSofa::HttpAuth.username = 'newuser'
    ComfortableMexicanSofa::HttpAuth.password = 'newpass'
    http_auth :get, '/cms-admin/pages'
    assert_response :unauthorized
    http_auth :get, '/cms-admin/pages', {}, 'newuser', 'newpass'
    assert_response :success
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.0.36 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.35 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.34 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.33 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.32 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.31 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.30 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.29 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.28 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.27 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.26 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.25 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.24 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.23 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.22 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.21 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.20 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.19 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.18 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.0.17 test/integration/authentication_test.rb