aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/configuration_test.rb40
-rw-r--r--railties/test/application/loading_test.rb2
-rw-r--r--railties/test/application/rake/dbs_test.rb8
-rw-r--r--railties/test/application/rake/dev_test.rb35
4 files changed, 46 insertions, 39 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 5f3d1879eb..49f63d5d31 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -1393,5 +1393,45 @@ module ApplicationTests
assert_equal 'unicorn', Rails.application.config.my_custom_config['key']
end
+
+ test "api_only is false by default" do
+ app 'development'
+ refute Rails.application.config.api_only
+ end
+
+ test "api_only generator config is set when api_only is set" do
+ add_to_config <<-RUBY
+ config.api_only = true
+ RUBY
+ app 'development'
+
+ Rails.application.load_generators
+ assert Rails.configuration.api_only
+ end
+
+ test "debug_exception_response_format is :api by default if only_api is enabled" do
+ add_to_config <<-RUBY
+ config.api_only = true
+ RUBY
+ app 'development'
+
+ assert_equal :api, Rails.configuration.debug_exception_response_format
+ end
+
+ test "debug_exception_response_format can be override" do
+ add_to_config <<-RUBY
+ config.api_only = true
+ RUBY
+
+ app_file 'config/environments/development.rb', <<-RUBY
+ Rails.application.configure do
+ config.debug_exception_response_format = :default
+ end
+ RUBY
+
+ app 'development'
+
+ assert_equal :default, Rails.configuration.debug_exception_response_format
+ end
end
end
diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb
index 1027bca2c1..2106708c98 100644
--- a/railties/test/application/loading_test.rb
+++ b/railties/test/application/loading_test.rb
@@ -169,6 +169,8 @@ class LoadingTest < ActiveSupport::TestCase
config.file_watcher = Class.new do
def initialize(*); end
def updated?; false; end
+ def execute; end
+ def execute_if_updated; false; end
end
RUBY
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb
index f94d08673a..0b0fb50fe1 100644
--- a/railties/test/application/rake/dbs_test.rb
+++ b/railties/test/application/rake/dbs_test.rb
@@ -61,7 +61,7 @@ module ApplicationTests
test 'db:create failure because database exists' do
with_database_existing do
output = `bin/rake db:create 2>&1`
- assert_match /already exists/, output
+ assert_match(/already exists/, output)
assert_equal 0, $?.exitstatus
end
end
@@ -78,7 +78,7 @@ module ApplicationTests
test 'db:create failure because bad permissions' do
with_bad_permissions do
output = `bin/rake db:create 2>&1`
- assert_match /Couldn't create database/, output
+ assert_match(/Couldn't create database/, output)
assert_equal 1, $?.exitstatus
end
end
@@ -86,7 +86,7 @@ module ApplicationTests
test 'db:drop failure because database does not exist' do
Dir.chdir(app_path) do
output = `bin/rake db:drop 2>&1`
- assert_match /does not exist/, output
+ assert_match(/does not exist/, output)
assert_equal 0, $?.exitstatus
end
end
@@ -95,7 +95,7 @@ module ApplicationTests
with_database_existing do
with_bad_permissions do
output = `bin/rake db:drop 2>&1`
- assert_match /Couldn't drop/, output
+ assert_match(/Couldn't drop/, output)
assert_equal 1, $?.exitstatus
end
end
diff --git a/railties/test/application/rake/dev_test.rb b/railties/test/application/rake/dev_test.rb
deleted file mode 100644
index 28d8b22a37..0000000000
--- a/railties/test/application/rake/dev_test.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-require 'isolation/abstract_unit'
-
-module ApplicationTests
- module RakeTests
- class RakeDevTest < ActiveSupport::TestCase
- include ActiveSupport::Testing::Isolation
-
- def setup
- build_app
- boot_rails
- end
-
- def teardown
- teardown_app
- end
-
- test 'dev:cache creates file and outputs message' do
- Dir.chdir(app_path) do
- output = `rake dev:cache`
- assert File.exist?('tmp/caching-dev.txt')
- assert_match(/Development mode is now being cached/, output)
- end
- end
-
- test 'dev:cache deletes file and outputs message' do
- Dir.chdir(app_path) do
- output = `rake dev:cache`
- output = `rake dev:cache`
- assert_not File.exist?('tmp/caching-dev.txt')
- assert_match(/Development mode is no longer being cached/, output)
- end
- end
- end
- end
-end