Sha256: e51f71cbe7d55d5f93170edf9183c82f36f764310e9753b5a2655bf7492cf0e8

Contents?: true

Size: 927 Bytes

Versions: 13

Compression:

Stored size: 927 Bytes

Contents

require File.expand_path('../test_helper', File.dirname(__FILE__))

class AuthenticationTest < ActionDispatch::IntegrationTest
  
  def test_get_with_unauthorized_access
    assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.authentication
    get '/cms-admin/sites'
    assert_response :unauthorized
    get '/'
    assert_response :success
  end
  
  def test_get_with_authorized_access
    http_auth :get, '/cms-admin/sites'
    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/sites'
    assert_response :unauthorized
    http_auth :get, '/cms-admin/sites', {}, 'newuser', 'newpass'
    assert_response :success
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.4.3 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.4.2 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.4.1 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.4.0 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.8 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.7 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.6 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.5 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.4 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.3 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.2 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.1 test/integration/authentication_test.rb
comfortable_mexican_sofa-1.3.0 test/integration/authentication_test.rb