aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorEdward Rudd <urkle@outoforder.cc>2017-09-20 13:00:01 -0400
committerEdward Rudd <urkle@outoforder.cc>2019-04-03 18:09:34 -0400
commitc5efbbbccb8fabb25d95f6c5758225f31b3879ba (patch)
tree3e307cb17eb5a2833434260691a7dc47c55a9adf /actionview/test
parent2ca056be6f38e20add62bc3d370ae06a8263318b (diff)
downloadrails-c5efbbbccb8fabb25d95f6c5758225f31b3879ba.tar.gz
rails-c5efbbbccb8fabb25d95f6c5758225f31b3879ba.tar.bz2
rails-c5efbbbccb8fabb25d95f6c5758225f31b3879ba.zip
Fix checking for template variants when using the ActionView::FixtureResolver
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/testing/fixture_resolver_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionview/test/template/testing/fixture_resolver_test.rb b/actionview/test/template/testing/fixture_resolver_test.rb
index afb6686dac..a90440574e 100644
--- a/actionview/test/template/testing/fixture_resolver_test.rb
+++ b/actionview/test/template/testing/fixture_resolver_test.rb
@@ -17,4 +17,14 @@ class FixtureResolverTest < ActiveSupport::TestCase
assert_equal "arbitrary/path", templates.first.virtual_path
assert_nil templates.first.format
end
+
+ def test_should_match_templates_with_variants
+ resolver = ActionView::FixtureResolver.new("arbitrary/path.html+variant.erb" => "this text")
+ templates = resolver.find_all("path", "arbitrary", false, locale: [], formats: [:html], variants: [:variant], handlers: [:erb])
+ assert_equal 1, templates.size, "expected one template"
+ assert_equal "this text", templates.first.source
+ assert_equal "arbitrary/path", templates.first.virtual_path
+ assert_equal [:html], templates.first.formats
+ assert_equal ["variant"], templates.first.variants
+ end
end