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

Added a test for MissingTemplate change, and changed to use Array.wrap() as

requested by josevalim.
This commit is contained in:
Burke Libbey 2011-05-06 14:02:31 -05:00
parent 30d49d001e
commit 156039c4cf
3 changed files with 11 additions and 2 deletions

View file

@ -15,7 +15,7 @@ module ActionView #:nodoc:
end
def find_all(path, prefixes = [], *args)
prefixes = [prefixes] if String === prefixes
prefixes = Array.wrap(prefixes) if String === prefixes
prefixes.each do |prefix|
each do |resolver|
templates = resolver.find_all(path, prefix, *args)

View file

@ -29,7 +29,7 @@ module ActionView
def initialize(paths, path, prefixes, partial, details, *)
@path = path
prefixes = [prefixes] if String === prefixes
prefixes = Array.wrap(prefixes) if String === prefixes
display_paths = paths.compact.map{ |p| p.to_s.inspect }.join(", ")
template_type = if partial
"partial"

View file

@ -251,4 +251,13 @@ class TestMissingTemplate < ActiveSupport::TestCase
end
assert_match %r{Missing partial parent/foo, child/foo with .* Searched in:\n \* "/Path/to/views"\n}, e.message
end
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=>[]}
@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
end
end