mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove some globals from configuration tests
This commit is contained in:
parent
3429b0ccba
commit
5fc5665066
1 changed files with 20 additions and 20 deletions
|
@ -891,79 +891,79 @@ module ApplicationTests
|
||||||
end
|
end
|
||||||
|
|
||||||
test "rake_tasks block works at instance level" do
|
test "rake_tasks block works at instance level" do
|
||||||
$ran_block = false
|
|
||||||
|
|
||||||
app_file "config/environments/development.rb", <<-RUBY
|
app_file "config/environments/development.rb", <<-RUBY
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
|
config.ran_block = false
|
||||||
|
|
||||||
rake_tasks do
|
rake_tasks do
|
||||||
$ran_block = true
|
config.ran_block = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
|
assert_not Rails.configuration.ran_block
|
||||||
|
|
||||||
assert !$ran_block
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
require 'rdoc/task'
|
require 'rdoc/task'
|
||||||
|
|
||||||
Rails.application.load_tasks
|
Rails.application.load_tasks
|
||||||
assert $ran_block
|
assert Rails.configuration.ran_block
|
||||||
end
|
end
|
||||||
|
|
||||||
test "generators block works at instance level" do
|
test "generators block works at instance level" do
|
||||||
$ran_block = false
|
|
||||||
|
|
||||||
app_file "config/environments/development.rb", <<-RUBY
|
app_file "config/environments/development.rb", <<-RUBY
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
|
config.ran_block = false
|
||||||
|
|
||||||
generators do
|
generators do
|
||||||
$ran_block = true
|
config.ran_block = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
|
assert_not Rails.configuration.ran_block
|
||||||
|
|
||||||
assert !$ran_block
|
|
||||||
Rails.application.load_generators
|
Rails.application.load_generators
|
||||||
assert $ran_block
|
assert Rails.configuration.ran_block
|
||||||
end
|
end
|
||||||
|
|
||||||
test "console block works at instance level" do
|
test "console block works at instance level" do
|
||||||
$ran_block = false
|
|
||||||
|
|
||||||
app_file "config/environments/development.rb", <<-RUBY
|
app_file "config/environments/development.rb", <<-RUBY
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
|
config.ran_block = false
|
||||||
|
|
||||||
console do
|
console do
|
||||||
$ran_block = true
|
config.ran_block = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
|
assert_not Rails.configuration.ran_block
|
||||||
|
|
||||||
assert !$ran_block
|
|
||||||
Rails.application.load_console
|
Rails.application.load_console
|
||||||
assert $ran_block
|
assert Rails.configuration.ran_block
|
||||||
end
|
end
|
||||||
|
|
||||||
test "runner block works at instance level" do
|
test "runner block works at instance level" do
|
||||||
$ran_block = false
|
|
||||||
|
|
||||||
app_file "config/environments/development.rb", <<-RUBY
|
app_file "config/environments/development.rb", <<-RUBY
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
|
config.ran_block = false
|
||||||
|
|
||||||
runner do
|
runner do
|
||||||
$ran_block = true
|
config.ran_block = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
|
assert_not Rails.configuration.ran_block
|
||||||
|
|
||||||
assert !$ran_block
|
|
||||||
Rails.application.load_runner
|
Rails.application.load_runner
|
||||||
assert $ran_block
|
assert Rails.configuration.ran_block
|
||||||
end
|
end
|
||||||
|
|
||||||
test "loading the first existing database configuration available" do
|
test "loading the first existing database configuration available" do
|
||||||
|
|
Loading…
Reference in a new issue