Sha256: 081ab2fb7ace98bf5f9266a1a4db13c82fc12d0fe8a3a2da8eec5eb69ce3d44e

Contents?: true

Size: 1.7 KB

Versions: 15

Compression:

Stored size: 1.7 KB

Contents

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

class RoutingExtensionsTest < ActionDispatch::IntegrationTest
  
  def teardown
    reset_config
    Rails.application.reload_routes!
  end
  
  def test_get_admin_with_admin_route_prefix
    ComfortableMexicanSofa.config.admin_route_prefix = 'custom-admin'
    Rails.application.reload_routes!
    
    assert_exception_raised ActionController::RoutingError, 'Page Not Found' do
      http_auth :get, '/cms-admin/sites'
    end
    
    http_auth :get, '/custom-admin/sites'
    assert_response :success
  end
  
  def test_get_admin_with_admin_route_redirect
    ComfortableMexicanSofa.config.admin_route_redirect = '/cms-admin/sites'
    Rails.application.reload_routes!
    
    http_auth :get, '/cms-admin'
    assert_response :redirect
    assert_redirected_to cms_admin_sites_path
  end
  
  def test_get_admin_with_admin_route_prefix_disabled
    ComfortableMexicanSofa.config.admin_route_prefix = ''
    Rails.application.reload_routes!
    
    assert_exception_raised ActionController::RoutingError, 'Page Not Found' do
      http_auth :get, '/cms-admin'
    end
  end
  
  def test_get_admin_with_all_routes_disabled
    ComfortableMexicanSofa.config.use_default_routes = false
    Rails.application.reload_routes!
    
    assert_exception_raised ActionController::RoutingError do
      http_auth :get, '/'
    end
  end
  
  def test_get_sitemap
    get '/sitemap', :format => 'xml'
    assert_response :success
    
    ComfortableMexicanSofa.config.enable_sitemap = false
    Rails.application.reload_routes!
    
    assert_exception_raised ActionController::RoutingError, 'Page Not Found' do
      get '/sitemap', :format => 'xml'
    end
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.6.31 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.30 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.7.3 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.7.1 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.7.0 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.26 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.25 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.24 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.23 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.22 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.21 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.20 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.19 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.18 test/integration/routing_extensions_test.rb
comfortable_mexican_sofa-1.6.17 test/integration/routing_extensions_test.rb