Skip to content

Instantly share code, notes, and snippets.

@pixeltrix
Created December 30, 2013 10:42
Show Gist options
  • Save pixeltrix/8180473 to your computer and use it in GitHub Desktop.
Save pixeltrix/8180473 to your computer and use it in GitHub Desktop.
Test case for Ruby on Rails issue #13537 - https://github.com/rails/rails/issues/13537
require 'action_controller/railtie'
require 'minitest/autorun'
class RoutingApp < Rails::Application
config.eager_load = false
config.root = File.dirname(__FILE__)
config.session_store :cookie_store, key: 'session'
config.secret_key_base = 'secret'
end
RoutingApp.initialize!
RoutingApp.routes.draw do
resources :releases, only: [:index, :show], constraints: { id: /[0-9\.]+/ } do
resource :image, only: [:download] do
member do
get 'download'
end
end
end
end
require 'rails/test_help'
class RoutingTest < ActiveSupport::TestCase
include Rails.application.routes.url_helpers
def test_nested_singular_resource_path
assert_equal '/releases/1.9.0/image/download', download_release_image_path('1.9.0')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment