mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
a01e58afd9
Taken from @Sonopa's commits on PR #19091. Add support for dev caching via "rails s" flags. Implement suggestions from @kaspth. Remove temporary cache file if server does not have flags. Break at 80 characters in railties/CHANGELOG.md Remove ability to disable cache based on server options. Add more comprehensive options: --dev-caching / --no-dev-caching
35 lines
905 B
Ruby
35 lines
905 B
Ruby
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
|