From d345ce9630ce4c01bc81a09fb015e7bd935600ad Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 21 May 2015 21:26:26 +0200 Subject: 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. --- .../test/actionpack/controller/render_test.rb | 22 +++++++++++++++++++--- 1 file 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 -- cgit v1.2.3