Sha256: 67a026e14a8997cbdc9f32fb1c81bef695fe1455502beda132f990d72c0caccc

Contents?: true

Size: 1.88 KB

Versions: 14

Compression:

Stored size: 1.88 KB

Contents

require 'test/helper'

class RoutesTest < ActiveSupport::TestCase

  include ActionController::TestCase::Assertions

  def test_should_verify_admin_named_routes

    routes = ActionController::Routing::Routes.named_routes.routes.keys

    expected = [ :admin_sign_up, :admin_sign_in, :admin_sign_out, 
                 :admin_recover_password, :admin_reset_password, 
                 :admin_dashboard, 
                 :admin_quick_edit ]

    expected.each { |route| assert routes.include?(route) }

  end

  def test_should_verify_admin_named_routes_for_typus_users

    routes = ActionController::Routing::Routes.named_routes.routes.keys

    expected = [ :admin_typus_users, 
                 :admin_typus_user ]

    expected.each { |route| assert !routes.include?(route) }

    expected = [ :relate_admin_typus_user,
                 :unrelate_admin_typus_user ]

    expected.each { |route| assert !routes.include?(route) }

  end

  def test_should_verify_default_admin_named_routes_for_posts

    routes = ActionController::Routing::Routes.named_routes.routes.keys

    expected = [ :admin_posts, 
                 :admin_post ]

    expected.each { |route| assert !routes.include?(route) }

  end

  def test_should_verify_custom_admin_named_routes_for_posts

    routes = ActionController::Routing::Routes.named_routes.routes.keys

    expected = [ :cleanup_admin_posts, 
                 :send_as_newsletter_admin_post, 
                 :preview_admin_post ]

    expected.each { |route| assert !routes.include?(route) }

  end

  def test_should_verify_generated_routes_for_typus_controller

    assert_routing '/admin', :controller => 'typus', :action => 'dashboard'

    actions = [ 'sign_up', 'sign_in', 'sign_out', 
                'recover_password', 'reset_password', 
                'quick_edit' ]

    actions.each { |a| assert_routing "/admin/#{a}", :controller => 'typus', :action => a }

  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
typus-0.9.39 test/lib/routes_test.rb
typus-0.9.38 test/lib/routes_test.rb
typus-0.9.37 test/lib/routes_test.rb
typus-0.9.36 test/lib/routes_test.rb
typus-0.9.35 test/lib/routes_test.rb
typus-0.9.34 test/lib/routes_test.rb
typus-0.9.33 test/lib/routes_test.rb
typus-0.9.32 test/lib/routes_test.rb
typus-0.9.31 test/lib/routes_test.rb
typus-0.9.30 test/lib/routes_test.rb
typus-0.9.29 test/lib/routes_test.rb
typus-0.9.28 test/lib/routes_test.rb
typus-0.9.27 test/lib/routes_test.rb
typus-0.9.26 test/lib/routes_test.rb