diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2013-12-03 15:14:49 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2013-12-03 15:14:49 -0800 |
commit | 501acab943cdc3a5ac389cfd9b39dc34d3ca86fb (patch) | |
tree | d20232cd9ea12691bb126e48855ed8ced15c6371 /actionview/test | |
parent | 4d648819c5662f375b8ca431a14511ae6a97a29c (diff) | |
parent | eb0402d512a1fb4e65a4d8d3dab3684e9f136b34 (diff) | |
download | rails-501acab943cdc3a5ac389cfd9b39dc34d3ca86fb.tar.gz rails-501acab943cdc3a5ac389cfd9b39dc34d3ca86fb.tar.bz2 rails-501acab943cdc3a5ac389cfd9b39dc34d3ca86fb.zip |
Merge pull request #12977 from strzalek/action-pack-variants
Action Pack Variants
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/lookup_context_test.rb | 7 | ||||
-rw-r--r-- | actionview/test/template/testing/fixture_resolver_test.rb | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb index a6a3d6279e..ce9485e146 100644 --- a/actionview/test/template/lookup_context_test.rb +++ b/actionview/test/template/lookup_context_test.rb @@ -36,6 +36,11 @@ class LookupContextTest < ActiveSupport::TestCase assert @lookup_context.formats.frozen? end + test "provides getters and setters for variants" do + @lookup_context.variants = [:mobile] + assert_equal [:mobile], @lookup_context.variants + end + test "provides getters and setters for formats" do @lookup_context.formats = [:html] assert_equal [:html], @lookup_context.formats @@ -254,7 +259,7 @@ class TestMissingTemplate < ActiveSupport::TestCase test "if a single prefix is passed as a string and the lookup fails, MissingTemplate accepts it" do e = assert_raise ActionView::MissingTemplate do - details = {:handlers=>[], :formats=>[], :locale=>[]} + details = {:handlers=>[], :formats=>[], :variants=>[], :locale=>[]} @lookup_context.view_paths.find("foo", "parent", true, details) end assert_match %r{Missing partial parent/_foo with .* Searched in:\n \* "/Path/to/views"\n}, e.message diff --git a/actionview/test/template/testing/fixture_resolver_test.rb b/actionview/test/template/testing/fixture_resolver_test.rb index 9649f349cb..d6cfa997cd 100644 --- a/actionview/test/template/testing/fixture_resolver_test.rb +++ b/actionview/test/template/testing/fixture_resolver_test.rb @@ -3,13 +3,13 @@ require 'abstract_unit' class FixtureResolverTest < ActiveSupport::TestCase def test_should_return_empty_list_for_unknown_path resolver = ActionView::FixtureResolver.new() - templates = resolver.find_all("path", "arbitrary", false, {:locale => [], :formats => [:html], :handlers => []}) + templates = resolver.find_all("path", "arbitrary", false, {:locale => [], :formats => [:html], :variants => [], :handlers => []}) assert_equal [], templates, "expected an empty list of templates" end def test_should_return_template_for_declared_path resolver = ActionView::FixtureResolver.new("arbitrary/path.erb" => "this text") - templates = resolver.find_all("path", "arbitrary", false, {:locale => [], :formats => [:html], :handlers => [:erb]}) + templates = resolver.find_all("path", "arbitrary", false, {:locale => [], :formats => [:html], :variants => [], :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 |