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

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.
This commit is contained in:
Xavier Noria 2015-05-21 21:26:26 +02:00
parent 448bf47fe7
commit d345ce9630

View file

@ -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