Last active
November 21, 2016 20:02
-
-
Save utilum/89a6bead2ea8a785a5935d5f1630fe2e to your computer and use it in GitHub Desktop.
Executable test for rails issue #27132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "rails", github: "rails/rails" | |
end | |
require "action_controller/railtie" | |
class TestApp < Rails::Application | |
config.root = File.dirname(__FILE__) | |
secrets.secret_token = "secret_token" | |
secrets.secret_key_base = "secret_key_base" | |
config.logger = Logger.new($stdout) | |
Rails.logger = config.logger | |
routes.draw do | |
get '/pretty-url-foo' => 'pages#show', defaults: {id: 1} | |
get '/pretty-url-bar' => 'pages#show', defaults: {id: 2} | |
end | |
end | |
require "minitest/autorun" | |
class BugTest < Minitest::Test | |
include Rack::Test::Methods | |
def test_weighs_default_param_value | |
assert_equal '/pretty-url-bar', Rails.application.routes.url_helpers.url_for(controller: 'pages', action: 'show', only_path: true, id: 2) | |
end | |
private | |
def app | |
Rails.application | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment