aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2015-05-21 21:26:26 +0200
committerXavier Noria <fxn@hashref.com>2015-05-21 21:45:51 +0200
commitd345ce9630ce4c01bc81a09fb015e7bd935600ad (patch)
treeb9366c77c58f04d469a486794c93c8d70abee119
parent448bf47fe7a1e5c440b7f7fffc12bebd5d649a83 (diff)
downloadrails-d345ce9630ce4c01bc81a09fb015e7bd935600ad.tar.gz
rails-d345ce9630ce4c01bc81a09fb015e7bd935600ad.tar.bz2
rails-d345ce9630ce4c01bc81a09fb015e7bd935600ad.zip
revises a test to account for case-insensitive file systems
The patched test assumed the file system is case-sensitive, but that is not necessarily the case. In particular, this test did not pass in the recommended setup for the dev box, because the /vagrant shared folder is case-insensitive. After looking at some gems that provide access to file system metadata I have chosen to go with the check you can see in the patch because, albeit it's a bit dirty creating a file, it is super easy to understand and clearly portable. References https://github.com/rails/rails-dev-box/issues/102.
-rw-r--r--actionview/test/actionpack/controller/render_test.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb
index 8b47536a18..ecebd2d8c5 100644
--- a/actionview/test/actionpack/controller/render_test.rb
+++ b/actionview/test/actionpack/controller/render_test.rb
@@ -1,5 +1,6 @@
require 'abstract_unit'
-require "active_model"
+require 'active_model'
+require 'fileutils'
class ApplicationController < ActionController::Base
self.view_paths = File.join(FIXTURE_LOAD_PATH, "actionpack")
@@ -678,6 +679,14 @@ class RenderTest < ActionController::TestCase
ActionView::Base.logger = nil
end
+ def case_sensitive_file_system?
+ fname = '.case_sensitive_file_system_test'
+ FileUtils.touch(fname)
+ !File.exists?(fname.upcase)
+ ensure
+ FileUtils.rm_f(fname)
+ end
+
# :ported:
def test_simple_show
get :hello_world
@@ -747,8 +756,15 @@ class RenderTest < ActionController::TestCase
end
def test_render_action_upcased
- assert_raise ActionView::MissingTemplate do
- get :render_action_upcased_hello_world
+ action = :render_action_upcased_hello_world
+
+ if case_sensitive_file_system?
+ assert_raise ActionView::MissingTemplate do
+ get action
+ end
+ else
+ get action
+ assert_template 'test/Hello_world'
end
end