aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-06-05 18:22:04 -0700
committerJohn Hawthorn <john@hawthorn.email>2019-06-05 18:40:06 -0700
commitd130ea2ff2f51dd1c53b2fb70305d71aad261c5d (patch)
tree496cc11c11c04f564d76ff124726d4051e29dcf7 /actionview/test
parentc4d8e057c540dd0ba424dcc5203db1c945b4b412 (diff)
downloadrails-d130ea2ff2f51dd1c53b2fb70305d71aad261c5d.tar.gz
rails-d130ea2ff2f51dd1c53b2fb70305d71aad261c5d.tar.bz2
rails-d130ea2ff2f51dd1c53b2fb70305d71aad261c5d.zip
Remove actionview tests which modify fixtures
We shouldn't modify fixtures (or any files which are checked-in). It prevents us from parallelizing, and probably has other issues. We could fix these tests by copying the file to a tmpdir and modifying it there, but I don't think they are testing anything useful anymore. Re-initializing a resolver isn't representative of "uncached" rendering (either in dev-mode or using lookup_context.disable_cache).
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/compiled_templates_test.rb40
1 files changed, 1 insertions, 39 deletions
diff --git a/actionview/test/template/compiled_templates_test.rb b/actionview/test/template/compiled_templates_test.rb
index d7f2e8ee07..59fa058bed 100644
--- a/actionview/test/template/compiled_templates_test.rb
+++ b/actionview/test/template/compiled_templates_test.rb
@@ -60,46 +60,8 @@ class CompiledTemplatesTest < ActiveSupport::TestCase
assert_equal "two", render(template: "test/render_file_with_locals_and_default", locals: { secret: "two" })
end
- def test_template_changes_are_not_reflected_with_cached_templates
- assert_equal "Hello world!", render(template: "test/hello_world")
- modify_template "test/hello_world.erb", "Goodbye world!" do
- assert_equal "Hello world!", render(template: "test/hello_world")
- end
- assert_equal "Hello world!", render(template: "test/hello_world")
- end
-
- def test_template_changes_are_reflected_with_uncached_templates
- assert_equal "Hello world!", render_without_cache(template: "test/hello_world")
- modify_template "test/hello_world.erb", "Goodbye world!" do
- assert_equal "Goodbye world!", render_without_cache(template: "test/hello_world")
- end
- assert_equal "Hello world!", render_without_cache(template: "test/hello_world")
- end
-
private
def render(*args)
- render_with_cache(*args)
- end
-
- def render_with_cache(*args)
- view_paths = ActionController::Base.view_paths
- view_class.with_view_paths(view_paths, {}).render(*args)
- end
-
- def render_without_cache(*args)
- path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH)
- view_paths = ActionView::PathSet.new([path])
- view_class.with_view_paths(view_paths, {}).render(*args)
- end
-
- def modify_template(template, content)
- filename = "#{FIXTURE_LOAD_PATH}/#{template}"
- old_content = File.read(filename)
- begin
- File.open(filename, "wb+") { |f| f.write(content) }
- yield
- ensure
- File.open(filename, "wb+") { |f| f.write(old_content) }
- end
+ ActionController::Base.render(*args)
end
end