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

Merge pull request #20605 from dcrec1/assert_file

assert_file understands paths with special characters
This commit is contained in:
Yves Senn 2015-06-19 11:13:16 +02:00
commit e97b8cb15f
4 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,8 @@
* `assert_file` understands paths with special characters
(eg. `v0.1.4~alpha+nightly`).
*Diego Carrion*
* Remove ContentLength middleware from the defaults. If you want it, just
add it as a middleware in your config.

View file

@ -23,7 +23,7 @@ module Rails
# end
# end
def assert_file(relative, *contents)
absolute = File.expand_path(relative, destination_root).shellescape
absolute = File.expand_path(relative, destination_root)
assert File.exist?(absolute), "Expected file #{relative.inspect} to exist, but does not"
read = File.read(absolute) if block_given? || !contents.empty?

View file

@ -499,7 +499,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
def test_application_name_with_spaces
path = File.join(destination_root, "foo bar".shellescape)
path = File.join(destination_root, "foo bar")
# This also applies to MySQL apps but not with SQLite
run_generator [path, "-d", 'postgresql']

View file

@ -122,5 +122,13 @@ module RailtiesTests
assert_no_file "app/helpers/foo_bar/topics_helper.rb"
end
end
def test_assert_file_with_special_characters
path = "#{app_path}/tmp"
file_name = "#{path}/v0.1.4~alpha+nightly"
FileUtils.mkdir_p path
FileUtils.touch file_name
assert_file file_name
end
end
end