diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-08-05 21:37:57 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-08-05 21:37:57 +0200 |
commit | 2d00aa7a93b711d27f6672849cc456f14deab529 (patch) | |
tree | 1c532c7d4c7112441b76c3400ace0ff547d36be3 /railties/test | |
parent | 57989c58dfffa8854d2bcb706202cd04a418da70 (diff) | |
parent | a01e58afd9ef301db17e952a9a42a4ec96cc5661 (diff) | |
download | rails-2d00aa7a93b711d27f6672849cc456f14deab529.tar.gz rails-2d00aa7a93b711d27f6672849cc456f14deab529.tar.bz2 rails-2d00aa7a93b711d27f6672849cc456f14deab529.zip |
Merge pull request #20961 from ccallebs/add-dev-mode-caching
Add dev caching toggle / server options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/rake/dev_test.rb | 35 | ||||
-rw-r--r-- | railties/test/commands/server_test.rb | 16 |
2 files changed, 51 insertions, 0 deletions
diff --git a/railties/test/application/rake/dev_test.rb b/railties/test/application/rake/dev_test.rb new file mode 100644 index 0000000000..28d8b22a37 --- /dev/null +++ b/railties/test/application/rake/dev_test.rb @@ -0,0 +1,35 @@ +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 diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb index ba688f1e9e..7a063aeddf 100644 --- a/railties/test/commands/server_test.rb +++ b/railties/test/commands/server_test.rb @@ -44,6 +44,22 @@ class Rails::ServerTest < ActiveSupport::TestCase end end + def test_caching_without_option + args = [] + options = Rails::Server::Options.new.parse!(args) + assert_equal nil, options[:caching] + end + + def test_caching_with_option + args = ["--dev-caching"] + options = Rails::Server::Options.new.parse!(args) + assert_equal true, options[:caching] + + args = ["--no-dev-caching"] + options = Rails::Server::Options.new.parse!(args) + assert_equal false, options[:caching] + end + def test_log_stdout with_rack_env nil do with_rails_env nil do |