diff options
author | Diego Carrion <dc.rec1@gmail.com> | 2015-06-17 13:53:19 -0300 |
---|---|---|
committer | Diego Carrion <dcrec1@mbp.home> | 2015-06-18 11:59:47 -0300 |
commit | 6074d0f6d30bf3be8c6d73f336be6d21115c2f75 (patch) | |
tree | cfbd02cd310231a9b6a398ac7b806afb49857a4b | |
parent | ba7377e8176315e7ac6ba1c24b2479925dc37cde (diff) | |
download | rails-6074d0f6d30bf3be8c6d73f336be6d21115c2f75.tar.gz rails-6074d0f6d30bf3be8c6d73f336be6d21115c2f75.tar.bz2 rails-6074d0f6d30bf3be8c6d73f336be6d21115c2f75.zip |
assert_file understands paths with special characters
fixes #20042
-rw-r--r-- | railties/lib/rails/generators/testing/assertions.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 2 | ||||
-rw-r--r-- | railties/test/railties/generators_test.rb | 8 |
3 files changed, 10 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/testing/assertions.rb b/railties/lib/rails/generators/testing/assertions.rb index bd069e4bd0..17af6eddfa 100644 --- a/railties/lib/rails/generators/testing/assertions.rb +++ b/railties/lib/rails/generators/testing/assertions.rb @@ -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? diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index af1c05cab1..a11dc6ae35 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -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'] diff --git a/railties/test/railties/generators_test.rb b/railties/test/railties/generators_test.rb index 423ece277e..b88815cbbe 100644 --- a/railties/test/railties/generators_test.rb +++ b/railties/test/railties/generators_test.rb @@ -122,5 +122,13 @@ module RailtiesTests assert_no_file "app/helpers/foo_bar/topics_helper.rb" end end + + def test_assert_file_founds_files_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 |