1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #10902 from wangjohn/removing_application_singleton_calls

Calls to the application constant have been refactored
This commit is contained in:
Santiago Pastorino 2013-06-17 17:37:54 -07:00
commit 9ec2e2ee91
12 changed files with 23 additions and 23 deletions

View file

@ -14,7 +14,7 @@ module ApplicationTests
app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>" app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>"
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/posts', to: "posts#index" get '/posts', to: "posts#index"
end end
RUBY RUBY

View file

@ -45,7 +45,7 @@ module ApplicationTests
app_file "app/assets/javascripts/demo.js.erb", "a = <%= image_path('rails.png').inspect %>;" app_file "app/assets/javascripts/demo.js.erb", "a = <%= image_path('rails.png').inspect %>;"
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, ["Not an asset"]] } get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, ["Not an asset"]] }
end end
RUBY RUBY
@ -313,7 +313,7 @@ module ApplicationTests
app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();" app_file "app/assets/javascripts/demo.js.erb", "<%= :alert %>();"
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/omg', :to => "omg#index" get '/omg', :to => "omg#index"
end end
RUBY RUBY
@ -463,7 +463,7 @@ module ApplicationTests
app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>" app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>"
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/posts', :to => "posts#index" get '/posts', :to => "posts#index"
end end
RUBY RUBY

View file

@ -41,7 +41,7 @@ module ApplicationTests
test "allows me to configure default url options for ActionMailer" do test "allows me to configure default url options for ActionMailer" do
app_file "config/environments/development.rb", <<-RUBY app_file "config/environments/development.rb", <<-RUBY
AppTemplate::Application.configure do Rails.application.configure do
config.action_mailer.default_url_options = { :host => "test.rails" } config.action_mailer.default_url_options = { :host => "test.rails" }
end end
RUBY RUBY
@ -52,7 +52,7 @@ module ApplicationTests
test "does not include url helpers as action methods" do test "does not include url helpers as action methods" do
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get "/foo", :to => lambda { |env| [200, {}, []] }, :as => :foo get "/foo", :to => lambda { |env| [200, {}, []] }, :as => :foo
end end
RUBY RUBY
@ -115,7 +115,7 @@ module ApplicationTests
RUBY RUBY
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get "/:controller(/:action)" get "/:controller(/:action)"
end end
RUBY RUBY

View file

@ -84,7 +84,7 @@ en:
RUBY RUBY
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/i18n', :to => lambda { |env| [200, {}, [Foo.instance_variable_get('@foo')]] } get '/i18n', :to => lambda { |env| [200, {}, [Foo.instance_variable_get('@foo')]] }
end end
RUBY RUBY
@ -108,7 +108,7 @@ en:
YAML YAML
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/i18n', :to => lambda { |env| [200, {}, [I18n.t(:foo)]] } get '/i18n', :to => lambda { |env| [200, {}, [I18n.t(:foo)]] }
end end
RUBY RUBY

View file

@ -75,7 +75,7 @@ module ApplicationTests
$initialize_test_set_from_env = nil $initialize_test_set_from_env = nil
app_file "config/environments/development.rb", <<-RUBY app_file "config/environments/development.rb", <<-RUBY
$initialize_test_set_from_env = 'success' $initialize_test_set_from_env = 'success'
AppTemplate::Application.configure do Rails.application.configure do
config.cache_classes = true config.cache_classes = true
config.time_zone = "Brasilia" config.time_zone = "Brasilia"
end end
@ -89,8 +89,8 @@ module ApplicationTests
require "#{app_path}/config/environment" require "#{app_path}/config/environment"
assert_equal "success", $initialize_test_set_from_env assert_equal "success", $initialize_test_set_from_env
assert AppTemplate::Application.config.cache_classes assert Rails.application.config.cache_classes
assert_equal "Brasilia", AppTemplate::Application.config.time_zone assert_equal "Brasilia", Rails.application.config.time_zone
end end
end end
end end

View file

@ -213,7 +213,7 @@ class LoadingTest < ActiveSupport::TestCase
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
$counter ||= 1 $counter ||= 1
$counter *= 2 $counter *= 2
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/c', to: lambda { |env| User; [200, {"Content-Type" => "text/plain"}, [$counter.to_s]] } get '/c', to: lambda { |env| User; [200, {"Content-Type" => "text/plain"}, [$counter.to_s]] }
end end
RUBY RUBY

View file

@ -45,7 +45,7 @@ module ApplicationTests
RUBY RUBY
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get ':controller(/:action)' get ':controller(/:action)'
end end
RUBY RUBY

View file

@ -88,7 +88,7 @@ module ApplicationTests
add_to_config "config.ssl_options = { host: 'example.com' }" add_to_config "config.ssl_options = { host: 'example.com' }"
boot! boot!
assert_equal AppTemplate::Application.middleware.first.args, [{host: 'example.com'}] assert_equal Rails.application.middleware.first.args, [{host: 'example.com'}]
end end
test "removing Active Record omits its middleware" do test "removing Active Record omits its middleware" do
@ -225,7 +225,7 @@ module ApplicationTests
end end
def middleware def middleware
AppTemplate::Application.middleware.map(&:klass).map(&:name) Rails.application.middleware.map(&:klass).map(&:name)
end end
end end
end end

View file

@ -30,7 +30,7 @@ module ApplicationTests
app_file "config/environment.rb", <<-RUBY app_file "config/environment.rb", <<-RUBY
SuperMiddleware = Struct.new(:app) SuperMiddleware = Struct.new(:app)
AppTemplate::Application.configure do Rails.application.configure do
config.middleware.use SuperMiddleware config.middleware.use SuperMiddleware
end end
@ -142,7 +142,7 @@ module ApplicationTests
def test_rake_routes_calls_the_route_inspector def test_rake_routes_calls_the_route_inspector
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/cart', to: 'cart#show' get '/cart', to: 'cart#show'
end end
RUBY RUBY
@ -153,7 +153,7 @@ module ApplicationTests
def test_rake_routes_with_controller_environment def test_rake_routes_with_controller_environment
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get '/cart', to: 'cart#show' get '/cart', to: 'cart#show'
get '/basketball', to: 'basketball#index' get '/basketball', to: 'basketball#index'
end end
@ -166,7 +166,7 @@ module ApplicationTests
def test_rake_routes_displays_message_when_no_routes_are_defined def test_rake_routes_displays_message_when_no_routes_are_defined
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
end end
RUBY RUBY

View file

@ -17,7 +17,7 @@ module ApplicationTests
test "Unknown format falls back to HTML template" do test "Unknown format falls back to HTML template" do
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get 'pages/:id', to: 'pages#show' get 'pages/:id', to: 'pages#show'
end end
RUBY RUBY

View file

@ -163,7 +163,7 @@ module TestHelpers
RUBY RUBY
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
get ':controller(/:action)' get ':controller(/:action)'
end end
RUBY RUBY

View file

@ -16,7 +16,7 @@ module ApplicationTests
@metrics_plugin = engine "metrics" @metrics_plugin = engine "metrics"
app_file 'config/routes.rb', <<-RUBY app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do Rails.application.routes.draw do
mount Weblog::Engine, :at => '/', :as => 'weblog' mount Weblog::Engine, :at => '/', :as => 'weblog'
resources :posts resources :posts
get "/engine_route" => "application_generating#engine_route" get "/engine_route" => "application_generating#engine_route"