Skip to content

Instantly share code, notes, and snippets.

@utilum
Created November 21, 2016 20:09
Show Gist options
  • Save utilum/da579d6c0cffb6be783d0b037bfe2376 to your computer and use it in GitHub Desktop.
Save utilum/da579d6c0cffb6be783d0b037bfe2376 to your computer and use it in GitHub Desktop.
Executable test for Rails issue 27132 (Rails 4.0.0)
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"
# Activate the gem you are reporting the issue against.
gem "rails", "4.0.0"
end
require "rack/test"
require "action_controller/railtie"
class TestApp < Rails::Application
config.root = File.dirname(__FILE__)
config.session_store :cookie_store, key: "cookie_store_key"
#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 "test/unit"
class BugTest < ActionDispatch::IntegrationTest
#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