1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/application/url_generation_test.rb
wangjohn bb4378404d Removing use of subclassed application constant and instead using the
more agnostic Rails.application syntax. This means tests will be more
portable, and won't rely on the existence of a particular subclass.
2013-06-03 21:38:17 -07:00

45 lines
1 KiB
Ruby

require 'isolation/abstract_unit'
module ApplicationTests
class UrlGenerationTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
def app
Rails.application
end
test "it works" do
boot_rails
require "rails"
require "action_controller/railtie"
class MyApp < Rails::Application
config.secret_key_base = "3b7cd727ee24e8444053437c36cc66c4"
config.session_store :cookie_store, key: "_myapp_session"
config.active_support.deprecation = :log
config.eager_load = false
end
Rails.application.initialize!
class ::ApplicationController < ActionController::Base
end
class ::OmgController < ::ApplicationController
def index
render text: omg_path
end
end
MyApp.routes.draw do
get "/" => "omg#index", as: :omg
end
require 'rack/test'
extend Rack::Test::Methods
get "/"
assert_equal "/", last_response.body
end
end
end