Sha256: 0bde6de468ef759d6ccc220073c59218eec841e76fd6dae45d37d5c6af7b1270

Contents?: true

Size: 1.91 KB

Versions: 21

Compression:

Stored size: 1.91 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, :admin_set_locale ]

    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', 'set_locale' ]

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

  end

end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
fesplugas-typus-0.9.10 test/lib/routes_test.rb
fesplugas-typus-0.9.11 test/lib/routes_test.rb
fesplugas-typus-0.9.12 test/lib/routes_test.rb
fesplugas-typus-0.9.13 test/lib/routes_test.rb
fesplugas-typus-0.9.14 test/lib/routes_test.rb
fesplugas-typus-0.9.15 test/lib/routes_test.rb
fesplugas-typus-0.9.16 test/lib/routes_test.rb
fesplugas-typus-0.9.17 test/lib/routes_test.rb
fesplugas-typus-0.9.6 test/lib/routes_test.rb
fesplugas-typus-0.9.7 test/lib/routes_test.rb
fesplugas-typus-0.9.8 test/lib/routes_test.rb
fesplugas-typus-0.9.9 test/lib/routes_test.rb
typus-0.9.25 test/lib/routes_test.rb
typus-0.9.24 test/lib/routes_test.rb
typus-0.9.23 test/lib/routes_test.rb
typus-0.9.22 test/lib/routes_test.rb
typus-0.9.21 test/lib/routes_test.rb
typus-0.9.20 test/lib/routes_test.rb
typus-0.9.19 test/lib/routes_test.rb
typus-0.9.18 test/lib/routes_test.rb