Namespace
- CLASS TestRoutingMapper::IpRestrictor
- CLASS TestRoutingMapper::TestAltApp
- CLASS TestRoutingMapper::YoutubeFavoritesRedirector
Methods
- A
- T
-
- test_access_token_rooms,
- test_account_namespace,
- test_action_from_path_is_not_frozen,
- test_admin,
- test_articles_perma,
- test_articles_with_id,
- test_assert_recognizes_account_overview,
- test_bookmarks,
- test_constraints_are_merged_from_scope,
- test_constraints_block_not_carried_to_following_routes,
- test_controller_name_with_leading_slash_raise_error,
- test_controller_option_with_nesting_and_leading_slash,
- test_convention_match_nested_and_with_leading_slash,
- test_convention_with_explicit_end,
- test_custom_resource_actions_defined_using_string,
- test_custom_resource_routes_are_scoped,
- test_default_params,
- test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper,
- test_except_option_should_not_inherit,
- test_except_option_should_override_scope,
- test_except_option_should_override_scoped_only,
- test_except_scope_should_override_parent_only_scope,
- test_except_scope_should_override_parent_scope,
- test_except_should_be_read_from_scope,
- test_explicitly_avoiding_the_named_route,
- test_forum_products,
- test_glob_parameter_accepts_regexp,
- test_global,
- test_greedy_resource_id_regexp_doesnt_match_edit_and_custom_action,
- test_index,
- test_invalid_route_name_raises_error,
- test_local,
- test_login,
- test_login_redirect,
- test_logout,
- test_logout_redirect_without_to,
- test_match_shorthand_inside_namespace,
- test_match_shorthand_inside_namespace_with_controller,
- test_match_shorthand_inside_nested_namespaces_and_scopes_with_controller,
- test_match_shorthand_inside_scope_with_variables_with_controller,
- test_match_shorthand_with_no_scope,
- test_member_on_resource,
- test_module_scope,
- test_named_character_classes_in_regexp_constraints,
- test_named_route_with_no_side_effects,
- test_named_routes_collision_is_avoided_unless_explicitly_given_as,
- test_namespace_nested_in_resources,
- test_namespace_redirect,
- test_namespace_with_controller_segment,
- test_namespace_with_options,
- test_namespaced_roots,
- test_nested_namespace,
- test_nested_optional_path_shorthand,
- test_nested_optional_scoped_path,
- test_nested_resource_constraints,
- test_nested_route_in_nested_resource,
- test_non_greedy_regexp,
- test_normalize_namespaced_matches,
- test_only_option_should_not_inherit,
- test_only_option_should_override_scope,
- test_only_option_should_override_scoped_except,
- test_only_scope_should_override_parent_except_scope,
- test_only_scope_should_override_parent_scope,
- test_only_should_be_read_from_scope,
- test_openid,
- test_optional_scoped_path,
- test_optional_scoped_root,
- test_pagemarks,
- test_path_names,
- test_path_option_override,
- test_path_scope,
- test_project_images,
- test_project_manager,
- test_projects,
- test_projects_attachments,
- test_projects_companies,
- test_projects_involvements,
- test_projects_participants,
- test_projects_people,
- test_projects_posts,
- test_projects_status,
- test_projects_with_resources_path_names,
- test_redirect_argument_error,
- test_redirect_class,
- test_redirect_deprecated_proc,
- test_redirect_hash_path_substitution,
- test_redirect_hash_path_substitution_with_catch_all,
- test_redirect_hash_with_domain_and_path,
- test_redirect_hash_with_host,
- test_redirect_hash_with_path,
- test_redirect_hash_with_subdomain,
- test_redirect_https,
- test_redirect_modulo,
- test_redirect_proc,
- test_redirect_proc_with_request,
- test_redirect_with_complete_url_and_status,
- test_redirect_with_port,
- test_replies,
- test_resource_constraints,
- test_resource_constraints_are_pushed_to_scope,
- test_resource_does_not_modify_passed_options,
- test_resource_merges_options_from_scope,
- test_resource_new_actions,
- test_resource_routes_only_create_update_destroy,
- test_resource_routes_with_only_and_except,
- test_resource_with_slugs_in_ids,
- test_resources_are_not_pluralized,
- test_resources_controller_name_is_not_pluralized,
- test_resources_does_not_modify_passed_options,
- test_resources_for_uncountable_names,
- test_resources_merges_options_from_scope,
- test_resources_path_can_be_a_symbol,
- test_resources_routes_only_create_update_destroy,
- test_root,
- test_root_in_deeply_nested_scope,
- test_root_works_in_the_resources_scope,
- test_route_defined_in_resources_scope_level,
- test_router_removes_invalid_conditions,
- test_scoped_controller_with_namespace_and_action,
- test_session_info_nested_singleton_resource,
- test_session_singleton_resource,
- test_shallow_nested_resources,
- test_shallow_nested_resources_within_scope,
- test_shallow_nested_routes_ignore_module,
- test_singleton_resources_are_not_singularized,
- test_sprockets,
- test_symbolized_path_parameters_is_not_stale,
- test_update_person_route,
- test_update_project_person,
- test_url_for_does_not_modify_controller,
- test_url_for_with_no_side_effects,
- test_url_generator_for_generic_route,
- test_url_generator_for_namespaced_generic_route,
- test_url_generator_for_optional_prefix_dynamic_segment,
- test_url_generator_for_optional_prefix_static_and_dynamic_segment,
- test_url_generator_for_optional_suffix_static_and_dynamic_segment,
- test_url_recognition_for_optional_static_segments
Included Modules
Constants
| SprocketsApp | = | lambda { |env| [200, {"Content-Type" => "text/html"}, ["javascripts"]] } |
| Routes | = | routes |
Instance Public methods
app()
Link
test_access_token_rooms()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1384 def test_access_token_rooms with_test_routes do get '/12345/rooms' assert_equal 'rooms#index', @response.body get '/12345/rooms/1' assert_equal 'rooms#show', @response.body get '/12345/rooms/1/edit' assert_equal 'rooms#edit', @response.body end end
test_account_namespace()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1328 def test_account_namespace with_test_routes do get '/account/subscription' assert_equal 'account/subscriptions#show', @response.body assert_equal '/account/subscription', account_subscription_path get '/account/credit' assert_equal 'account/credits#show', @response.body assert_equal '/account/credit', account_credit_path get '/account/credit_card' assert_equal 'account/credit_cards#show', @response.body assert_equal '/account/credit_card', account_credit_card_path end end
test_action_from_path_is_not_frozen()
Link
test_admin()
Link
# File actionpack/test/dispatch/routing_test.rb, line 848 def test_admin with_test_routes do get '/admin', {}, {'REMOTE_ADDR' => '192.168.1.100'} assert_equal 'queenbee#index', @response.body get '/admin', {}, {'REMOTE_ADDR' => '10.0.0.100'} assert_equal 'pass', @response.headers['X-Cascade'] get '/admin/accounts', {}, {'REMOTE_ADDR' => '192.168.1.100'} assert_equal 'queenbee#accounts', @response.body get '/admin/accounts', {}, {'REMOTE_ADDR' => '10.0.0.100'} assert_equal 'pass', @response.headers['X-Cascade'] get '/admin/passwords', {}, {'REMOTE_ADDR' => '192.168.1.100'} assert_equal 'queenbee#passwords', @response.body get '/admin/passwords', {}, {'REMOTE_ADDR' => '10.0.0.100'} assert_equal 'pass', @response.headers['X-Cascade'] end end
test_articles_perma()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1319 def test_articles_perma with_test_routes do get '/articles/2009/08/18/rails-3' assert_equal 'articles#show', @response.body assert_equal '/articles/2009/8/18/rails-3', article_path(:year => 2009, :month => 8, :day => 18, :title => 'rails-3') end end
test_articles_with_id()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1372 def test_articles_with_id with_test_routes do get '/articles/rails/1' assert_equal 'articles#with_id', @response.body get '/articles/123/1' assert_equal 'pass', @response.headers['X-Cascade'] assert_equal '/articles/rails/1', article_with_title_path(:title => 'rails', :id => 1) end end
test_assert_recognizes_account_overview()
Link
test_bookmarks()
Link
# File actionpack/test/dispatch/routing_test.rb, line 808 def test_bookmarks with_test_routes do get '/bookmark/build' assert_equal 'bookmarks#new', @response.body assert_equal '/bookmark/build', bookmark_new_path post '/bookmark/create' assert_equal 'bookmarks#create', @response.body assert_equal '/bookmark/create', bookmark_path put '/bookmark/update' assert_equal 'bookmarks#update', @response.body assert_equal '/bookmark/update', bookmark_update_path get '/bookmark/remove' assert_equal 'bookmarks#destroy', @response.body assert_equal '/bookmark/remove', bookmark_remove_path end end
test_constraints_are_merged_from_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2040 def test_constraints_are_merged_from_scope with_test_routes do get '/movies/0001' assert_equal 'movies#show', @response.body assert_equal '/movies/0001', movie_path(:id => '0001') get '/movies/00001' assert_equal 'Not Found', @response.body assert_raises(ActionController::RoutingError){ movie_path(:id => '00001') } get '/movies/0001/reviews' assert_equal 'reviews#index', @response.body assert_equal '/movies/0001/reviews', movie_reviews_path(:movie_id => '0001') get '/movies/00001/reviews' assert_equal 'Not Found', @response.body assert_raises(ActionController::RoutingError){ movie_reviews_path(:movie_id => '00001') } get '/movies/0001/reviews/0001' assert_equal 'reviews#show', @response.body assert_equal '/movies/0001/reviews/0001', movie_review_path(:movie_id => '0001', :id => '0001') get '/movies/00001/reviews/0001' assert_equal 'Not Found', @response.body assert_raises(ActionController::RoutingError){ movie_path(:movie_id => '00001', :id => '00001') } get '/movies/0001/trailer' assert_equal 'trailers#show', @response.body assert_equal '/movies/0001/trailer', movie_trailer_path(:movie_id => '0001') get '/movies/00001/trailer' assert_equal 'Not Found', @response.body assert_raises(ActionController::RoutingError){ movie_trailer_path(:movie_id => '00001') } end end
test_constraints_block_not_carried_to_following_routes()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2373 def test_constraints_block_not_carried_to_following_routes get '/italians/writers' assert_equal 'Not Found', @response.body get '/italians/sculptors' assert_equal 'italians#sculptors', @response.body get '/italians/painters/botticelli' assert_equal 'Not Found', @response.body get '/italians/painters/michelangelo' assert_equal 'italians#painters', @response.body end
test_controller_name_with_leading_slash_raise_error()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2445 def test_controller_name_with_leading_slash_raise_error assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/feeds/:service', :to => '/feeds#show' } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/feeds/:service', :controller => '/feeds', :action => 'show' } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/api/feeds/:service', :to => '/api/feeds#show' } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { controller("/feeds") { get '/feeds/:service', :to => :show } } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { resources :feeds, :controller => '/feeds' } end end end
test_controller_option_with_nesting_and_leading_slash()
Link
test_convention_match_nested_and_with_leading_slash()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1476 def test_convention_match_nested_and_with_leading_slash with_test_routes do assert_equal '/account/nested/overview', account_nested_overview_path get '/account/nested/overview' assert_equal 'account/nested#overview', @response.body end end
test_convention_with_explicit_end()
Link
test_custom_resource_actions_defined_using_string()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2387 def test_custom_resource_actions_defined_using_string get '/customers/inactive' assert_equal 'customers#inactive', @response.body assert_equal '/customers/inactive', inactive_customers_path post '/customers/1/deactivate' assert_equal 'customers#deactivate', @response.body assert_equal '/customers/1/deactivate', deactivate_customer_path(:id => '1') get '/customers/old' assert_equal 'customers#old', @response.body assert_equal '/customers/old', stale_customers_path get '/customers/1/invoices/aged/3' assert_equal 'invoices#aged', @response.body assert_equal '/customers/1/invoices/aged/3', aged_customer_invoices_path(:customer_id => '1', :months => '3') end
test_custom_resource_routes_are_scoped()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1888 def test_custom_resource_routes_are_scoped with_test_routes do assert_equal '/customers/recent', recent_customers_path assert_equal '/customers/1/profile', profile_customer_path(:id => '1') assert_equal '/customers/1/secret/profile', secret_profile_customer_path(:id => '1') assert_equal '/customers/new/preview', another_preview_new_customer_path assert_equal '/customers/1/avatar/thumbnail.jpg', thumbnail_customer_avatar_path(:customer_id => '1', :format => :jpg) assert_equal '/customers/1/invoices/outstanding', outstanding_customer_invoices_path(:customer_id => '1') assert_equal '/customers/1/invoices/2/print', print_customer_invoice_path(:customer_id => '1', :id => '2') assert_equal '/customers/1/invoices/new/preview', preview_new_customer_invoice_path(:customer_id => '1') assert_equal '/customers/1/notes/new/preview', preview_new_customer_note_path(:customer_id => '1') assert_equal '/notes/1/print', print_note_path(:id => '1') assert_equal '/api/customers/recent', recent_api_customers_path assert_equal '/api/customers/1/profile', profile_api_customer_path(:id => '1') assert_equal '/api/customers/new/preview', preview_new_api_customer_path get '/customers/1/invoices/overdue' assert_equal 'invoices#overdue', @response.body get '/customers/1/secret/profile' assert_equal 'customers#secret', @response.body end end
test_default_params()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1586 def test_default_params with_test_routes do get '/inline_pages' assert_equal 'home', @request.params[:id] get '/default_pages' assert_equal 'home', @request.params[:id] get '/scoped_pages' assert_equal 'home', @request.params[:id] end end
test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper()
Link
test_except_option_should_not_inherit()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2168 def test_except_option_should_not_inherit with_test_routes do get '/except/sectors/1/companies/2' assert_equal 'except/companies#show', @response.body assert_equal '/except/sectors/1/companies/2', except_sector_company_path(:sector_id => '1', :id => '2') get '/except/sectors/1/leader' assert_equal 'except/leaders#show', @response.body assert_equal '/except/sectors/1/leader', except_sector_leader_path(:sector_id => '1') end end
test_except_option_should_override_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2156 def test_except_option_should_override_scope with_test_routes do get '/except/sectors' assert_equal 'except/sectors#index', @response.body assert_equal '/except/sectors', except_sectors_path get '/except/sectors/1' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { except_sector_path(:id => '1') } end end
test_except_option_should_override_scoped_only()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2180 def test_except_option_should_override_scoped_only with_test_routes do get '/only/sectors/1/managers' assert_equal 'only/managers#index', @response.body assert_equal '/only/sectors/1/managers', only_sector_managers_path(:sector_id => '1') get '/only/sectors/1/managers/2' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { only_sector_manager_path(:sector_id => '1', :id => '2') } end end
test_except_scope_should_override_parent_only_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2228 def test_except_scope_should_override_parent_only_scope with_test_routes do get '/only/sectors/1/companies/2/departments' assert_equal 'only/departments#index', @response.body assert_equal '/only/sectors/1/companies/2/departments', only_sector_company_departments_path(:sector_id => '1', :company_id => '2') get '/only/sectors/1/companies/2/departments/3' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { only_sector_company_department_path(:sector_id => '1', :company_id => '2', :id => '3') } end end
test_except_scope_should_override_parent_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2216 def test_except_scope_should_override_parent_scope with_test_routes do get '/except/sectors/1/companies/2/divisions' assert_equal 'except/divisions#index', @response.body assert_equal '/except/sectors/1/companies/2/divisions', except_sector_company_divisions_path(:sector_id => '1', :company_id => '2') get '/except/sectors/1/companies/2/divisions/3' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { except_sector_company_division_path(:sector_id => '1', :company_id => '2', :id => '3') } end end
test_except_should_be_read_from_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2104 def test_except_should_be_read_from_scope with_test_routes do get '/except/clubs' assert_equal 'except/clubs#index', @response.body assert_equal '/except/clubs', except_clubs_path get '/except/clubs/1/edit' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { edit_except_club_path(:id => '1') } get '/except/clubs/1/players' assert_equal 'except/players#index', @response.body assert_equal '/except/clubs/1/players', except_club_players_path(:club_id => '1') get '/except/clubs/1/players/2/edit' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { edit_except_club_player_path(:club_id => '1', :id => '2') } get '/except/clubs/1/chairman' assert_equal 'except/chairmen#show', @response.body assert_equal '/except/clubs/1/chairman', except_club_chairman_path(:club_id => '1') get '/except/clubs/1/chairman/edit' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { edit_except_club_chairman_path(:club_id => '1') } end end
test_explicitly_avoiding_the_named_route()
Link
test_forum_products()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1299 def test_forum_products with_test_routes do get '/forum' assert_equal 'forum/products#index', @response.body assert_equal '/forum', forum_products_path get '/forum/basecamp' assert_equal 'forum/products#show', @response.body assert_equal '/forum/basecamp', forum_product_path(:id => 'basecamp') get '/forum/basecamp/questions' assert_equal 'forum/questions#index', @response.body assert_equal '/forum/basecamp/questions', forum_product_questions_path(:product_id => 'basecamp') get '/forum/basecamp/questions/1' assert_equal 'forum/questions#show', @response.body assert_equal '/forum/basecamp/questions/1', forum_product_question_path(:product_id => 'basecamp', :id => 1) end end
test_glob_parameter_accepts_regexp()
Link
test_global()
Link
# File actionpack/test/dispatch/routing_test.rb, line 870 def test_global with_test_routes do get '/global/dashboard' assert_equal 'global#dashboard', @response.body get '/global/export' assert_equal 'global#export', @response.body get '/global/hide_notice' assert_equal 'global#hide_notice', @response.body get '/export/123/foo.txt' assert_equal 'global#export', @response.body assert_equal '/global/export', export_request_path assert_equal '/global/hide_notice', global_hide_notice_path assert_equal '/export/123/foo.txt', export_download_path(:id => 123, :file => 'foo.txt') end end
test_greedy_resource_id_regexp_doesnt_match_edit_and_custom_action()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2306 def test_greedy_resource_id_regexp_doesnt_match_edit_and_custom_action with_test_routes do get '/sections/1/edit' assert_equal 'sections#edit', @response.body assert_equal '/sections/1/edit', edit_section_path(:id => '1') get '/sections/1/preview' assert_equal 'sections#preview', @response.body assert_equal '/sections/1/preview', preview_section_path(:id => '1') end end
test_index()
Link
test_invalid_route_name_raises_error()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2477 def test_invalid_route_name_raises_error assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/products', :to => 'products#index', :as => 'products ' } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/products', :to => 'products#index', :as => ' products' } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/products', :to => 'products#index', :as => 'products!' } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/products', :to => 'products#index', :as => 'products index' } end end assert_raise(ArgumentError) do self.class.stub_controllers do |routes| routes.draw { get '/products', :to => 'products#index', :as => '1products' } end end end
test_local()
Link
test_login()
Link
# File actionpack/test/dispatch/routing_test.rb, line 617 def test_login with_test_routes do get '/login' assert_equal 'sessions#new', @response.body assert_equal '/login', login_path post '/login' assert_equal 'sessions#create', @response.body assert_equal '/login', url_for(:controller => 'sessions', :action => 'create', :only_path => true) assert_equal '/login', url_for(:controller => 'sessions', :action => 'new', :only_path => true) assert_equal 'http://rubyonrails.org/login', Routes.url_for(:controller => 'sessions', :action => 'create') assert_equal 'http://rubyonrails.org/login', Routes.url_helpers.login_url end end
test_login_redirect()
Link
test_logout()
Link
# File actionpack/test/dispatch/routing_test.rb, line 607 def test_logout with_test_routes do delete '/logout' assert_equal 'sessions#destroy', @response.body assert_equal '/logout', logout_path assert_equal '/logout', url_for(:controller => 'sessions', :action => 'destroy', :only_path => true) end end
test_logout_redirect_without_to()
Link
test_match_shorthand_inside_namespace()
Link
test_match_shorthand_inside_namespace_with_controller()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1429 def test_match_shorthand_inside_namespace_with_controller with_test_routes do assert_equal '/api/products/list', api_products_list_path get '/api/products/list' assert_equal 'api/products#list', @response.body end end
test_match_shorthand_inside_nested_namespaces_and_scopes_with_controller()
Link
test_match_shorthand_inside_scope_with_variables_with_controller()
Link
test_match_shorthand_with_no_scope()
Link
test_member_on_resource()
Link
test_module_scope()
Link
test_named_character_classes_in_regexp_constraints()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2411 def test_named_character_classes_in_regexp_constraints get '/purchases/315004be7e/Ruby_on_Rails_3.pdf' assert_equal 'purchases#fetch', @response.body assert_equal '/purchases/315004be7e/Ruby_on_Rails_3.pdf', purchase_path(:token => '315004be7e', :filename => 'Ruby_on_Rails_3.pdf') end
test_named_route_with_no_side_effects()
Link
tests the arguments modification free version of define_hash_access
# File actionpack/test/dispatch/routing_test.rb, line 919 def test_named_route_with_no_side_effects original_options = { :host => 'test.host' } options = original_options.dup profile_customer_url("customer_model", options) # verify that the options passed in have not changed from the original ones assert_equal original_options, options end
test_named_routes_collision_is_avoided_unless_explicitly_given_as()
Link
test_namespace_nested_in_resources()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1352 def test_namespace_nested_in_resources with_test_routes do get '/clients/1/google/account' assert_equal '/clients/1/google/account', client_google_account_path(1) assert_equal 'google/accounts#show', @response.body get '/clients/1/google/account/secret/info' assert_equal '/clients/1/google/account/secret/info', client_google_account_secret_info_path(1) assert_equal 'google/secret/infos#show', @response.body end end
test_namespace_redirect()
Link
test_namespace_with_controller_segment()
Link
test_namespace_with_options()
Link
test_namespaced_roots()
Link
test_nested_namespace()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1344 def test_nested_namespace with_test_routes do get '/account/admin/subscription' assert_equal 'account/admin/subscriptions#show', @response.body assert_equal '/account/admin/subscription', account_admin_subscription_path end end
test_nested_optional_path_shorthand()
Link
test_nested_optional_scoped_path()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1555 def test_nested_optional_scoped_path with_test_routes do assert_equal '/admin/en/descriptions', admin_descriptions_path("en") assert_equal '/admin/descriptions', admin_descriptions_path(nil) assert_equal '/admin/en/descriptions/1', admin_description_path("en", 1) assert_equal '/admin/descriptions/1', admin_description_path(nil, 1) get '/admin/en/descriptions' assert_equal 'admin/descriptions#index', @response.body get '/admin/descriptions' assert_equal 'admin/descriptions#index', @response.body get '/admin/en/descriptions/1' assert_equal 'admin/descriptions#show', @response.body get '/admin/descriptions/1' assert_equal 'admin/descriptions#show', @response.body end end
test_nested_resource_constraints()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2417 def test_nested_resource_constraints get '/lists/01234012340123401234fffff' assert_equal 'lists#show', @response.body assert_equal '/lists/01234012340123401234fffff', list_path(:id => '01234012340123401234fffff') get '/lists/01234012340123401234fffff/todos/1' assert_equal 'todos#show', @response.body assert_equal '/lists/01234012340123401234fffff/todos/1', list_todo_path(:list_id => '01234012340123401234fffff', :id => '1') get '/lists/2/todos/1' assert_equal 'Not Found', @response.body assert_raises(ActionController::RoutingError){ list_todo_path(:list_id => '2', :id => '1') } end
test_nested_route_in_nested_resource()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2509 def test_nested_route_in_nested_resource get "/posts/1/comments/2/views" assert_equal "comments#views", @response.body assert_equal "/posts/1/comments/2/views", post_comment_views_path(:post_id => '1', :comment_id => '2') end
test_non_greedy_regexp()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1924 def test_non_greedy_regexp with_test_routes do get '/api/1.0/users' assert_equal 'api/users#index', @response.body assert_equal '/api/1.0/users', api_users_path(:version => '1.0') get '/api/1.0/users.json' assert_equal 'api/users#index', @response.body assert_equal true, @request.format.json? assert_equal '/api/1.0/users.json', api_users_path(:version => '1.0', :format => :json) get '/api/1.0/users/first.last' assert_equal 'api/users#show', @response.body assert_equal 'first.last', @request.params[:id] assert_equal '/api/1.0/users/first.last', api_user_path(:version => '1.0', :id => 'first.last') get '/api/1.0/users/first.last.xml' assert_equal 'api/users#show', @response.body assert_equal 'first.last', @request.params[:id] assert_equal true, @request.format.xml? assert_equal '/api/1.0/users/first.last.xml', api_user_path(:version => '1.0', :id => 'first.last', :format => :xml) end end
test_normalize_namespaced_matches()
Link
test_only_option_should_not_inherit()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2144 def test_only_option_should_not_inherit with_test_routes do get '/only/sectors/1/companies/2' assert_equal 'only/companies#show', @response.body assert_equal '/only/sectors/1/companies/2', only_sector_company_path(:sector_id => '1', :id => '2') get '/only/sectors/1/leader' assert_equal 'only/leaders#show', @response.body assert_equal '/only/sectors/1/leader', only_sector_leader_path(:sector_id => '1') end end
test_only_option_should_override_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2132 def test_only_option_should_override_scope with_test_routes do get '/only/sectors' assert_equal 'only/sectors#index', @response.body assert_equal '/only/sectors', only_sectors_path get '/only/sectors/1' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { only_sector_path(:id => '1') } end end
test_only_option_should_override_scoped_except()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2192 def test_only_option_should_override_scoped_except with_test_routes do get '/except/sectors/1/managers' assert_equal 'except/managers#index', @response.body assert_equal '/except/sectors/1/managers', except_sector_managers_path(:sector_id => '1') get '/except/sectors/1/managers/2' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { except_sector_manager_path(:sector_id => '1', :id => '2') } end end
test_only_scope_should_override_parent_except_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2240 def test_only_scope_should_override_parent_except_scope with_test_routes do get '/except/sectors/1/companies/2/departments' assert_equal 'except/departments#index', @response.body assert_equal '/except/sectors/1/companies/2/departments', except_sector_company_departments_path(:sector_id => '1', :company_id => '2') get '/except/sectors/1/companies/2/departments/3' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { except_sector_company_department_path(:sector_id => '1', :company_id => '2', :id => '3') } end end
test_only_scope_should_override_parent_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2204 def test_only_scope_should_override_parent_scope with_test_routes do get '/only/sectors/1/companies/2/divisions' assert_equal 'only/divisions#index', @response.body assert_equal '/only/sectors/1/companies/2/divisions', only_sector_company_divisions_path(:sector_id => '1', :company_id => '2') get '/only/sectors/1/companies/2/divisions/3' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { only_sector_company_division_path(:sector_id => '1', :company_id => '2', :id => '3') } end end
test_only_should_be_read_from_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2076 def test_only_should_be_read_from_scope with_test_routes do get '/only/clubs' assert_equal 'only/clubs#index', @response.body assert_equal '/only/clubs', only_clubs_path get '/only/clubs/1/edit' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { edit_only_club_path(:id => '1') } get '/only/clubs/1/players' assert_equal 'only/players#index', @response.body assert_equal '/only/clubs/1/players', only_club_players_path(:club_id => '1') get '/only/clubs/1/players/2/edit' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { edit_only_club_player_path(:club_id => '1', :id => '2') } get '/only/clubs/1/chairman' assert_equal 'only/chairmen#show', @response.body assert_equal '/only/clubs/1/chairman', only_club_chairman_path(:club_id => '1') get '/only/clubs/1/chairman/edit' assert_equal 'Not Found', @response.body assert_raise(NoMethodError) { edit_only_club_chairman_path(:club_id => '1') } end end
test_openid()
Link
test_optional_scoped_path()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1534 def test_optional_scoped_path with_test_routes do assert_equal '/en/descriptions', descriptions_path("en") assert_equal '/descriptions', descriptions_path(nil) assert_equal '/en/descriptions/1', description_path("en", 1) assert_equal '/descriptions/1', description_path(nil, 1) get '/en/descriptions' assert_equal 'descriptions#index', @response.body get '/descriptions' assert_equal 'descriptions#index', @response.body get '/en/descriptions/1' assert_equal 'descriptions#show', @response.body get '/descriptions/1' assert_equal 'descriptions#show', @response.body end end
test_optional_scoped_root()
Link
test_pagemarks()
Link
# File actionpack/test/dispatch/routing_test.rb, line 828 def test_pagemarks with_test_routes do get '/pagemark/build' assert_equal 'pagemarks#new', @response.body assert_equal '/pagemark/build', pagemark_new_path post '/pagemark/create' assert_equal 'pagemarks#create', @response.body assert_equal '/pagemark/create', pagemark_path put '/pagemark/update' assert_equal 'pagemarks#update', @response.body assert_equal '/pagemark/update', pagemark_update_path get '/pagemark/remove' assert_equal 'pagemarks#destroy', @response.body assert_equal '/pagemark/remove', pagemark_remove_path end end
test_path_names()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1238 def test_path_names with_test_routes do get '/pt/projetos' assert_equal 'projects#index', @response.body assert_equal '/pt/projetos', pt_projects_path get '/pt/projetos/1/editar' assert_equal 'projects#edit', @response.body assert_equal '/pt/projetos/1/editar', edit_pt_project_path(1) get '/pt/administrador' assert_equal 'admins#show', @response.body assert_equal '/pt/administrador', pt_admin_path get '/pt/administrador/novo' assert_equal 'admins#new', @response.body assert_equal '/pt/administrador/novo', new_pt_admin_path put '/pt/administrador/ativar' assert_equal 'admins#activate', @response.body assert_equal '/pt/administrador/ativar', activate_pt_admin_path end end
test_path_option_override()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1262 def test_path_option_override with_test_routes do get '/pt/projetos/novo/abrir' assert_equal 'projects#open', @response.body assert_equal '/pt/projetos/novo/abrir', open_new_pt_project_path put '/pt/projetos/1/fechar' assert_equal 'projects#close', @response.body assert_equal '/pt/projetos/1/fechar', close_pt_project_path(1) end end
test_path_scope()
Link
test_project_images()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1049 def test_project_images with_test_routes do get '/projects/1/images' assert_equal 'images#index', @response.body assert_equal '/projects/1/images', project_funny_images_path(:project_id => '1') get '/projects/1/images/new' assert_equal 'images#new', @response.body assert_equal '/projects/1/images/new', new_project_funny_image_path(:project_id => '1') post '/projects/1/images/1/revise' assert_equal 'images#revise', @response.body assert_equal '/projects/1/images/1/revise', revise_project_funny_image_path(:project_id => '1', :id => '1') end end
test_project_manager()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1033 def test_project_manager with_test_routes do get '/projects/1/manager' assert_equal 'managers#show', @response.body assert_equal '/projects/1/manager', project_super_manager_path(:project_id => '1') get '/projects/1/manager/new' assert_equal 'managers#new', @response.body assert_equal '/projects/1/manager/new', new_project_super_manager_path(:project_id => '1') post '/projects/1/manager/fire' assert_equal 'managers#fire', @response.body assert_equal '/projects/1/manager/fire', fire_project_super_manager_path(:project_id => '1') end end
test_projects()
Link
# File actionpack/test/dispatch/routing_test.rb, line 936 def test_projects with_test_routes do get '/projects' assert_equal 'project#index', @response.body assert_equal '/projects', projects_path post '/projects' assert_equal 'project#create', @response.body get '/projects.xml' assert_equal 'project#index', @response.body assert_equal '/projects.xml', projects_path(:format => 'xml') get '/projects/new' assert_equal 'project#new', @response.body assert_equal '/projects/new', new_project_path get '/projects/new.xml' assert_equal 'project#new', @response.body assert_equal '/projects/new.xml', new_project_path(:format => 'xml') get '/projects/1' assert_equal 'project#show', @response.body assert_equal '/projects/1', project_path(:id => '1') get '/projects/1.xml' assert_equal 'project#show', @response.body assert_equal '/projects/1.xml', project_path(:id => '1', :format => 'xml') get '/projects/1/edit' assert_equal 'project#edit', @response.body assert_equal '/projects/1/edit', edit_project_path(:id => '1') end end
test_projects_attachments()
Link
# File actionpack/test/dispatch/routing_test.rb, line 997 def test_projects_attachments with_test_routes do get '/projects/1/attachments' assert_equal 'attachments#index', @response.body assert_equal '/projects/1/attachments', project_attachments_path(:project_id => '1') end end
test_projects_companies()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1017 def test_projects_companies with_test_routes do get '/projects/1/companies' assert_equal 'companies#index', @response.body assert_equal '/projects/1/companies', project_companies_path(:project_id => '1') get '/projects/1/companies/1/people' assert_equal 'people#index', @response.body assert_equal '/projects/1/companies/1/people', project_company_people_path(:project_id => '1', :company_id => '1') get '/projects/1/companies/1/avatar' assert_equal 'avatar#show', @response.body assert_equal '/projects/1/companies/1/avatar', project_company_avatar_path(:project_id => '1', :company_id => '1') end end
test_projects_involvements()
Link
# File actionpack/test/dispatch/routing_test.rb, line 971 def test_projects_involvements with_test_routes do get '/projects/1/involvements' assert_equal 'involvements#index', @response.body assert_equal '/projects/1/involvements', project_involvements_path(:project_id => '1') get '/projects/1/involvements/new' assert_equal 'involvements#new', @response.body assert_equal '/projects/1/involvements/new', new_project_involvement_path(:project_id => '1') get '/projects/1/involvements/1' assert_equal 'involvements#show', @response.body assert_equal '/projects/1/involvements/1', project_involvement_path(:project_id => '1', :id => '1') put '/projects/1/involvements/1' assert_equal 'involvements#update', @response.body delete '/projects/1/involvements/1' assert_equal 'involvements#destroy', @response.body get '/projects/1/involvements/1/edit' assert_equal 'involvements#edit', @response.body assert_equal '/projects/1/involvements/1/edit', edit_project_involvement_path(:project_id => '1', :id => '1') end end
test_projects_participants()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1005 def test_projects_participants with_test_routes do get '/projects/1/participants' assert_equal 'participants#index', @response.body assert_equal '/projects/1/participants', project_participants_path(:project_id => '1') put '/projects/1/participants/update_all' assert_equal 'participants#update_all', @response.body assert_equal '/projects/1/participants/update_all', update_all_project_participants_path(:project_id => '1') end end
test_projects_people()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1065 def test_projects_people with_test_routes do get '/projects/1/people' assert_equal 'people#index', @response.body assert_equal '/projects/1/people', project_people_path(:project_id => '1') get '/projects/1/people/1' assert_equal 'people#show', @response.body assert_equal '/projects/1/people/1', project_person_path(:project_id => '1', :id => '1') get '/projects/1/people/1/7a2dec8/avatar' assert_equal 'avatars#show', @response.body assert_equal '/projects/1/people/1/7a2dec8/avatar', project_person_avatar_path(:project_id => '1', :person_id => '1', :access_token => '7a2dec8') put '/projects/1/people/1/accessible_projects' assert_equal 'people#accessible_projects', @response.body assert_equal '/projects/1/people/1/accessible_projects', accessible_projects_project_person_path(:project_id => '1', :id => '1') post '/projects/1/people/1/resend' assert_equal 'people#resend', @response.body assert_equal '/projects/1/people/1/resend', resend_project_person_path(:project_id => '1', :id => '1') post '/projects/1/people/1/generate_new_password' assert_equal 'people#generate_new_password', @response.body assert_equal '/projects/1/people/1/generate_new_password', generate_new_password_project_person_path(:project_id => '1', :id => '1') end end
test_projects_posts()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1101 def test_projects_posts with_test_routes do get '/projects/1/posts' assert_equal 'posts#index', @response.body assert_equal '/projects/1/posts', project_posts_path(:project_id => '1') get '/projects/1/posts/archive' assert_equal 'posts#archive', @response.body assert_equal '/projects/1/posts/archive', archive_project_posts_path(:project_id => '1') get '/projects/1/posts/toggle_view' assert_equal 'posts#toggle_view', @response.body assert_equal '/projects/1/posts/toggle_view', toggle_view_project_posts_path(:project_id => '1') post '/projects/1/posts/1/preview' assert_equal 'posts#preview', @response.body assert_equal '/projects/1/posts/1/preview', preview_project_post_path(:project_id => '1', :id => '1') get '/projects/1/posts/1/subscription' assert_equal 'subscriptions#show', @response.body assert_equal '/projects/1/posts/1/subscription', project_post_subscription_path(:project_id => '1', :post_id => '1') get '/projects/1/posts/1/comments' assert_equal 'comments#index', @response.body assert_equal '/projects/1/posts/1/comments', project_post_comments_path(:project_id => '1', :post_id => '1') post '/projects/1/posts/1/comments/preview' assert_equal 'comments#preview', @response.body assert_equal '/projects/1/posts/1/comments/preview', preview_project_post_comments_path(:project_id => '1', :post_id => '1') end end
test_projects_status()
Link
# File actionpack/test/dispatch/routing_test.rb, line 929 def test_projects_status with_test_routes do assert_equal '/projects/status', url_for(:controller => 'projects', :action => 'status', :only_path => true) assert_equal '/projects/status.json', url_for(:controller => 'projects', :action => 'status', :format => 'json', :only_path => true) end end
test_projects_with_resources_path_names()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1093 def test_projects_with_resources_path_names with_test_routes do get '/projects/info_about_correlation_indexes' assert_equal 'project#correlation_indexes', @response.body assert_equal '/projects/info_about_correlation_indexes', correlation_indexes_projects_path end end
test_redirect_argument_error()
Link
test_redirect_class()
Link
test_redirect_deprecated_proc()
Link
# File actionpack/test/dispatch/routing_test.rb, line 728 def test_redirect_deprecated_proc assert_deprecated do self.class.stub_controllers do |routes| routes.draw { match 'account/deprecated_proc/:name', :to => redirect {|params| "/#{params[:name].pluralize}" } } end end with_test_routes do get '/account/proc/person' verify_redirect 'http://www.example.com/people' end end
test_redirect_hash_path_substitution()
Link
test_redirect_hash_path_substitution_with_catch_all()
Link
test_redirect_hash_with_domain_and_path()
Link
test_redirect_hash_with_host()
Link
test_redirect_hash_with_path()
Link
test_redirect_hash_with_subdomain()
Link
test_redirect_https()
Link
test_redirect_modulo()
Link
test_redirect_proc()
Link
test_redirect_proc_with_request()
Link
test_redirect_with_complete_url_and_status()
Link
test_redirect_with_port()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1499 def test_redirect_with_port previous_host, self.host = self.host, 'www.example.com:3000' with_test_routes do get '/account/login' verify_redirect 'http://www.example.com:3000/login' end ensure self.host = previous_host end
test_replies()
Link
test_resource_constraints()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1599 def test_resource_constraints with_test_routes do get '/products/1' assert_equal 'pass', @response.headers['X-Cascade'] get '/products' assert_equal 'products#root', @response.body get '/products/favorite' assert_equal 'products#favorite', @response.body get '/products/0001' assert_equal 'products#show', @response.body get '/products/1/images' assert_equal 'pass', @response.headers['X-Cascade'] get '/products/0001/images' assert_equal 'images#index', @response.body get '/products/0001/images/0001' assert_equal 'images#show', @response.body get '/dashboard', {}, {'REMOTE_ADDR' => '10.0.0.100'} assert_equal 'pass', @response.headers['X-Cascade'] get '/dashboard', {}, {'REMOTE_ADDR' => '192.168.1.100'} assert_equal 'dashboards#show', @response.body end end
test_resource_constraints_are_pushed_to_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2318 def test_resource_constraints_are_pushed_to_scope with_test_routes do get '/wiki/articles/Ruby_on_Rails_3.0' assert_equal 'wiki/articles#show', @response.body assert_equal '/wiki/articles/Ruby_on_Rails_3.0', wiki_article_path(:id => 'Ruby_on_Rails_3.0') get '/wiki/articles/Ruby_on_Rails_3.0/comments/new' assert_equal 'wiki/comments#new', @response.body assert_equal '/wiki/articles/Ruby_on_Rails_3.0/comments/new', new_wiki_article_comment_path(:article_id => 'Ruby_on_Rails_3.0') post '/wiki/articles/Ruby_on_Rails_3.0/comments' assert_equal 'wiki/comments#create', @response.body assert_equal '/wiki/articles/Ruby_on_Rails_3.0/comments', wiki_article_comments_path(:article_id => 'Ruby_on_Rails_3.0') end end
test_resource_does_not_modify_passed_options()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1218 def test_resource_does_not_modify_passed_options options = {:id => /.+?/, :format => /json|xml/} self.class.stub_controllers do |routes| routes.draw do resource :user, options end end assert_equal({:id => /.+?/, :format => /json|xml/}, options) end
test_resource_merges_options_from_scope()
Link
test_resource_new_actions()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1681 def test_resource_new_actions with_test_routes do assert_equal '/replies/new/preview', preview_new_reply_path assert_equal '/pt/projetos/novo/preview', preview_new_pt_project_path assert_equal '/pt/administrador/novo/preview', preview_new_pt_admin_path assert_equal '/pt/products/novo/preview', preview_new_pt_product_path assert_equal '/profile/new/preview', preview_new_profile_path post '/replies/new/preview' assert_equal 'replies#preview', @response.body post '/pt/projetos/novo/preview' assert_equal 'projects#preview', @response.body post '/pt/administrador/novo/preview' assert_equal 'admins#preview', @response.body post '/pt/products/novo/preview' assert_equal 'products#preview', @response.body post '/profile/new/preview' assert_equal 'profiles#preview', @response.body end end
test_resource_routes_only_create_update_destroy()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1168 def test_resource_routes_only_create_update_destroy with_test_routes do delete '/past' assert_equal 'pasts#destroy', @response.body assert_equal '/past', past_path put '/present' assert_equal 'presents#update', @response.body assert_equal '/present', present_path post '/future' assert_equal 'futures#create', @response.body assert_equal '/future', future_path end end
test_resource_routes_with_only_and_except()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1143 def test_resource_routes_with_only_and_except with_test_routes do get '/posts' assert_equal 'posts#index', @response.body assert_equal '/posts', posts_path get '/posts/1' assert_equal 'posts#show', @response.body assert_equal '/posts/1', post_path(:id => 1) get '/posts/1/comments' assert_equal 'comments#index', @response.body assert_equal '/posts/1/comments', post_comments_path(:post_id => 1) post '/posts' assert_equal 'pass', @response.headers['X-Cascade'] put '/posts/1' assert_equal 'pass', @response.headers['X-Cascade'] delete '/posts/1' assert_equal 'pass', @response.headers['X-Cascade'] delete '/posts/1/comments' assert_equal 'pass', @response.headers['X-Cascade'] end end
test_resource_with_slugs_in_ids()
Link
test_resources_are_not_pluralized()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2252 def test_resources_are_not_pluralized with_test_routes do get '/transport/taxis' assert_equal 'transport/taxis#index', @response.body assert_equal '/transport/taxis', transport_taxis_path get '/transport/taxis/new' assert_equal 'transport/taxis#new', @response.body assert_equal '/transport/taxis/new', new_transport_taxi_path post '/transport/taxis' assert_equal 'transport/taxis#create', @response.body get '/transport/taxis/1' assert_equal 'transport/taxis#show', @response.body assert_equal '/transport/taxis/1', transport_taxi_path(:id => '1') get '/transport/taxis/1/edit' assert_equal 'transport/taxis#edit', @response.body assert_equal '/transport/taxis/1/edit', edit_transport_taxi_path(:id => '1') put '/transport/taxis/1' assert_equal 'transport/taxis#update', @response.body delete '/transport/taxis/1' assert_equal 'transport/taxis#destroy', @response.body end end
test_resources_controller_name_is_not_pluralized()
Link
test_resources_does_not_modify_passed_options()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1228 def test_resources_does_not_modify_passed_options options = {:id => /.+?/, :format => /json|xml/} self.class.stub_controllers do |routes| routes.draw do resources :users, options end end assert_equal({:id => /.+?/, :format => /json|xml/}, options) end
test_resources_for_uncountable_names()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1208 def test_resources_for_uncountable_names with_test_routes do assert_equal '/sheep', sheep_index_path assert_equal '/sheep/1', sheep_path(1) assert_equal '/sheep/new', new_sheep_path assert_equal '/sheep/1/edit', edit_sheep_path(1) assert_equal '/sheep/1/_it', _it_sheep_path(1) end end
test_resources_merges_options_from_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1715 def test_resources_merges_options_from_scope with_test_routes do assert_raise(NoMethodError) { edit_product_path('1') } get '/products/1/edit' assert_equal 404, status assert_raise(NoMethodError) { edit_product_image_path('1', '2') } post '/products/1/images/2/edit' assert_equal 404, status end end
test_resources_path_can_be_a_symbol()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2334 def test_resources_path_can_be_a_symbol with_test_routes do get '/pages' assert_equal 'wiki_pages#index', @response.body assert_equal '/pages', wiki_pages_path get '/pages/Ruby_on_Rails' assert_equal 'wiki_pages#show', @response.body assert_equal '/pages/Ruby_on_Rails', wiki_page_path(:id => 'Ruby_on_Rails') get '/my_account' assert_equal 'wiki_accounts#show', @response.body assert_equal '/my_account', wiki_account_path end end
test_resources_routes_only_create_update_destroy()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1184 def test_resources_routes_only_create_update_destroy with_test_routes do post '/relationships' assert_equal 'relationships#create', @response.body assert_equal '/relationships', relationships_path delete '/relationships/1' assert_equal 'relationships#destroy', @response.body assert_equal '/relationships/1', relationship_path(1) put '/friendships/1' assert_equal 'friendships#update', @response.body assert_equal '/friendships/1', friendship_path(1) end end
test_root()
Link
test_root_in_deeply_nested_scope()
Link
test_root_works_in_the_resources_scope()
Link
test_route_defined_in_resources_scope_level()
Link
test_router_removes_invalid_conditions()
Link
test_scoped_controller_with_namespace_and_action()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1465 def test_scoped_controller_with_namespace_and_action with_test_routes do assert_equal '/account/twitter/callback', account_callback_path("twitter") get '/account/twitter/callback' assert_equal 'account/callbacks#twitter', @response.body get '/account/whatever/callback' assert_equal 'Not Found', @response.body end end
test_session_info_nested_singleton_resource()
Link
test_session_singleton_resource()
Link
# File actionpack/test/dispatch/routing_test.rb, line 668 def test_session_singleton_resource with_test_routes do get '/session' assert_equal 'sessions#create', @response.body assert_equal '/session', session_path post '/session' assert_equal 'sessions#create', @response.body put '/session' assert_equal 'sessions#update', @response.body delete '/session' assert_equal 'sessions#destroy', @response.body get '/session/new' assert_equal 'sessions#new', @response.body assert_equal '/session/new', new_session_path get '/session/edit' assert_equal 'sessions#edit', @response.body assert_equal '/session/edit', edit_session_path post '/session/reset' assert_equal 'sessions#reset', @response.body assert_equal '/session/reset', reset_session_path end end
test_shallow_nested_resources()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1729 def test_shallow_nested_resources with_test_routes do get '/api/teams' assert_equal 'api/teams#index', @response.body assert_equal '/api/teams', api_teams_path get '/api/teams/new' assert_equal 'api/teams#new', @response.body assert_equal '/api/teams/new', new_api_team_path get '/api/teams/1' assert_equal 'api/teams#show', @response.body assert_equal '/api/teams/1', api_team_path(:id => '1') get '/api/teams/1/edit' assert_equal 'api/teams#edit', @response.body assert_equal '/api/teams/1/edit', edit_api_team_path(:id => '1') get '/api/teams/1/players' assert_equal 'api/players#index', @response.body assert_equal '/api/teams/1/players', api_team_players_path(:team_id => '1') get '/api/teams/1/players/new' assert_equal 'api/players#new', @response.body assert_equal '/api/teams/1/players/new', new_api_team_player_path(:team_id => '1') get '/api/players/2' assert_equal 'api/players#show', @response.body assert_equal '/api/players/2', api_player_path(:id => '2') get '/api/players/2/edit' assert_equal 'api/players#edit', @response.body assert_equal '/api/players/2/edit', edit_api_player_path(:id => '2') get '/api/teams/1/captain' assert_equal 'api/captains#show', @response.body assert_equal '/api/teams/1/captain', api_team_captain_path(:team_id => '1') get '/api/teams/1/captain/new' assert_equal 'api/captains#new', @response.body assert_equal '/api/teams/1/captain/new', new_api_team_captain_path(:team_id => '1') get '/api/teams/1/captain/edit' assert_equal 'api/captains#edit', @response.body assert_equal '/api/teams/1/captain/edit', edit_api_team_captain_path(:team_id => '1') get '/threads' assert_equal 'threads#index', @response.body assert_equal '/threads', threads_path get '/threads/new' assert_equal 'threads#new', @response.body assert_equal '/threads/new', new_thread_path get '/threads/1' assert_equal 'threads#show', @response.body assert_equal '/threads/1', thread_path(:id => '1') get '/threads/1/edit' assert_equal 'threads#edit', @response.body assert_equal '/threads/1/edit', edit_thread_path(:id => '1') get '/threads/1/owner' assert_equal 'owners#show', @response.body assert_equal '/threads/1/owner', thread_owner_path(:thread_id => '1') get '/threads/1/messages' assert_equal 'messages#index', @response.body assert_equal '/threads/1/messages', thread_messages_path(:thread_id => '1') get '/threads/1/messages/new' assert_equal 'messages#new', @response.body assert_equal '/threads/1/messages/new', new_thread_message_path(:thread_id => '1') get '/messages/2' assert_equal 'messages#show', @response.body assert_equal '/messages/2', message_path(:id => '2') get '/messages/2/edit' assert_equal 'messages#edit', @response.body assert_equal '/messages/2/edit', edit_message_path(:id => '2') get '/messages/2/comments' assert_equal 'comments#index', @response.body assert_equal '/messages/2/comments', message_comments_path(:message_id => '2') get '/messages/2/comments/new' assert_equal 'comments#new', @response.body assert_equal '/messages/2/comments/new', new_message_comment_path(:message_id => '2') get '/comments/3' assert_equal 'comments#show', @response.body assert_equal '/comments/3', comment_path(:id => '3') get '/comments/3/edit' assert_equal 'comments#edit', @response.body assert_equal '/comments/3/edit', edit_comment_path(:id => '3') post '/comments/3/preview' assert_equal 'comments#preview', @response.body assert_equal '/comments/3/preview', preview_comment_path(:id => '3') end end
test_shallow_nested_resources_within_scope()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1834 def test_shallow_nested_resources_within_scope with_test_routes do get '/hello/notes/1/trackbacks' assert_equal 'trackbacks#index', @response.body assert_equal '/hello/notes/1/trackbacks', note_trackbacks_path(:note_id => 1) get '/hello/notes/1/edit' assert_equal 'notes#edit', @response.body assert_equal '/hello/notes/1/edit', edit_note_path(:id => '1') get '/hello/notes/1/trackbacks/new' assert_equal 'trackbacks#new', @response.body assert_equal '/hello/notes/1/trackbacks/new', new_note_trackback_path(:note_id => 1) get '/hello/trackbacks/1' assert_equal 'trackbacks#show', @response.body assert_equal '/hello/trackbacks/1', trackback_path(:id => '1') get '/hello/trackbacks/1/edit' assert_equal 'trackbacks#edit', @response.body assert_equal '/hello/trackbacks/1/edit', edit_trackback_path(:id => '1') put '/hello/trackbacks/1' assert_equal 'trackbacks#update', @response.body post '/hello/notes/1/trackbacks' assert_equal 'trackbacks#create', @response.body delete '/hello/trackbacks/1' assert_equal 'trackbacks#destroy', @response.body get '/hello/notes' assert_equal 'notes#index', @response.body post '/hello/notes' assert_equal 'notes#create', @response.body get '/hello/notes/new' assert_equal 'notes#new', @response.body assert_equal '/hello/notes/new', new_note_path get '/hello/notes/1' assert_equal 'notes#show', @response.body assert_equal '/hello/notes/1', note_path(:id => 1) put '/hello/notes/1' assert_equal 'notes#update', @response.body delete '/hello/notes/1' assert_equal 'notes#destroy', @response.body end end
test_shallow_nested_routes_ignore_module()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1912 def test_shallow_nested_routes_ignore_module with_test_routes do get '/errors/1/notices' assert_equal 'api/notices#index', @response.body assert_equal '/errors/1/notices', error_notices_path(:error_id => '1') get '/notices/1' assert_equal 'api/notices#show', @response.body assert_equal '/notices/1', notice_path(:id => '1') end end
test_singleton_resources_are_not_singularized()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2281 def test_singleton_resources_are_not_singularized with_test_routes do get '/medical/taxis/new' assert_equal 'medical/taxes#new', @response.body assert_equal '/medical/taxis/new', new_medical_taxis_path post '/medical/taxis' assert_equal 'medical/taxes#create', @response.body get '/medical/taxis' assert_equal 'medical/taxes#show', @response.body assert_equal '/medical/taxis', medical_taxis_path get '/medical/taxis/edit' assert_equal 'medical/taxes#edit', @response.body assert_equal '/medical/taxis/edit', edit_medical_taxis_path put '/medical/taxis' assert_equal 'medical/taxes#update', @response.body delete '/medical/taxis' assert_equal 'medical/taxes#destroy', @response.body end end
test_sprockets()
Link
test_symbolized_path_parameters_is_not_stale()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2359 def test_symbolized_path_parameters_is_not_stale get '/countries/France' assert_equal 'countries#index', @response.body get '/countries/France/cities' assert_equal 'countries#cities', @response.body get '/countries/UK' verify_redirect 'http://www.example.com/countries/all' get '/countries/UK/cities' verify_redirect 'http://www.example.com/countries/all/cities' end
test_update_person_route()
Link
test_update_project_person()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1290 def test_update_project_person with_test_routes do get '/projects/1/people/2/update' assert_equal 'people#update', @response.body assert_equal '/projects/1/people/2/update', update_project_person_path(:project_id => 1, :id => 2) end end
test_url_for_does_not_modify_controller()
Link
# File actionpack/test/dispatch/routing_test.rb, line 909 def test_url_for_does_not_modify_controller controller = '/projects' options = {:controller => controller, :action => 'status', :only_path => true} url = url_for(options) assert_equal '/projects/status', url assert_equal '/projects', controller end
test_url_for_with_no_side_effects()
Link
tests the use of dup in url_for
# File actionpack/test/dispatch/routing_test.rb, line 898 def test_url_for_with_no_side_effects # without dup, additional (and possibly unwanted) values will be present in the options (eg. :host) original_options = {:controller => 'projects', :action => 'status'} options = original_options.dup url_for options # verify that the options passed in have not changed from the original ones assert_equal original_options, options end
test_url_generator_for_generic_route()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1649 def test_url_generator_for_generic_route with_test_routes do get 'whatever/foo/bar' assert_equal 'foo#bar', @response.body assert_equal 'http://www.example.com/whatever/foo/bar/1', url_for(:controller => "foo", :action => "bar", :id => 1) end end
test_url_generator_for_namespaced_generic_route()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1659 def test_url_generator_for_namespaced_generic_route with_test_routes do get 'whatever/foo/bar/show' assert_equal 'foo/bar#show', @response.body get 'whatever/foo/bar/show/1' assert_equal 'foo/bar#show', @response.body assert_equal 'http://www.example.com/whatever/foo/bar/show', url_for(:controller => "foo/bar", :action => "show") assert_equal 'http://www.example.com/whatever/foo/bar/show/1', url_for(:controller => "foo/bar", :action => "show", :id => '1') end end
test_url_generator_for_optional_prefix_dynamic_segment()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1962 def test_url_generator_for_optional_prefix_dynamic_segment with_test_routes do get '/bob/followers' assert_equal 'followers#index', @response.body assert_equal 'http://www.example.com/bob/followers', url_for(:controller => "followers", :action => "index", :username => "bob") get '/followers' assert_equal 'followers#index', @response.body assert_equal 'http://www.example.com/followers', url_for(:controller => "followers", :action => "index", :username => nil) end end
test_url_generator_for_optional_prefix_static_and_dynamic_segment()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1990 def test_url_generator_for_optional_prefix_static_and_dynamic_segment with_test_routes do get 'user/bob/photos' assert_equal 'photos#index', @response.body assert_equal 'http://www.example.com/user/bob/photos', url_for(:controller => "photos", :action => "index", :username => "bob") get 'photos' assert_equal 'photos#index', @response.body assert_equal 'http://www.example.com/photos', url_for(:controller => "photos", :action => "index", :username => nil) end end
test_url_generator_for_optional_suffix_static_and_dynamic_segment()
Link
# File actionpack/test/dispatch/routing_test.rb, line 1976 def test_url_generator_for_optional_suffix_static_and_dynamic_segment with_test_routes do get '/groups/user/bob' assert_equal 'groups#index', @response.body assert_equal 'http://www.example.com/groups/user/bob', url_for(:controller => "groups", :action => "index", :username => "bob") get '/groups' assert_equal 'groups#index', @response.body assert_equal 'http://www.example.com/groups', url_for(:controller => "groups", :action => "index", :username => nil) end end
test_url_recognition_for_optional_static_segments()
Link
# File actionpack/test/dispatch/routing_test.rb, line 2004 def test_url_recognition_for_optional_static_segments with_test_routes do get '/groups/discussions/messages' assert_equal 'messages#index', @response.body get '/groups/discussions/messages/1' assert_equal 'messages#show', @response.body get '/groups/messages' assert_equal 'messages#index', @response.body get '/groups/messages/1' assert_equal 'messages#show', @response.body get '/discussions/messages' assert_equal 'messages#index', @response.body get '/discussions/messages/1' assert_equal 'messages#show', @response.body get '/messages' assert_equal 'messages#index', @response.body get '/messages/1' assert_equal 'messages#show', @response.body end end