2010-02-25 19:48:36 -05:00
|
|
|
require 'isolation/abstract_unit'
|
|
|
|
|
|
|
|
module ApplicationTests
|
2012-01-05 20:30:17 -05:00
|
|
|
class UrlGenerationTest < ActiveSupport::TestCase
|
2010-02-25 19:48:36 -05:00
|
|
|
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
|
2010-04-05 04:52:47 -04:00
|
|
|
config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
|
2010-03-04 18:06:25 -05:00
|
|
|
config.session_store :cookie_store, :key => "_myapp_session"
|
2010-06-29 15:18:17 -04:00
|
|
|
config.active_support.deprecation = :log
|
2010-02-25 19:48:36 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
MyApp.initialize!
|
|
|
|
|
|
|
|
class ::ApplicationController < ActionController::Base
|
|
|
|
end
|
|
|
|
|
|
|
|
class ::OmgController < ::ApplicationController
|
|
|
|
def index
|
|
|
|
render :text => omg_path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
MyApp.routes.draw do
|
2012-04-24 23:32:09 -04:00
|
|
|
get "/" => "omg#index", :as => :omg
|
2010-02-25 19:48:36 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
require 'rack/test'
|
|
|
|
extend Rack::Test::Methods
|
|
|
|
|
|
|
|
get "/"
|
|
|
|
assert_equal "/", last_response.body
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|