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:
parent
30d49d001e
commit
156039c4cf
3 changed files with 11 additions and 2 deletions
|
@ -15,7 +15,7 @@ module ActionView #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_all(path, prefixes = [], *args)
|
def find_all(path, prefixes = [], *args)
|
||||||
prefixes = [prefixes] if String === prefixes
|
prefixes = Array.wrap(prefixes) if String === prefixes
|
||||||
prefixes.each do |prefix|
|
prefixes.each do |prefix|
|
||||||
each do |resolver|
|
each do |resolver|
|
||||||
templates = resolver.find_all(path, prefix, *args)
|
templates = resolver.find_all(path, prefix, *args)
|
||||||
|
|
|
@ -29,7 +29,7 @@ module ActionView
|
||||||
|
|
||||||
def initialize(paths, path, prefixes, partial, details, *)
|
def initialize(paths, path, prefixes, partial, details, *)
|
||||||
@path = path
|
@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(", ")
|
display_paths = paths.compact.map{ |p| p.to_s.inspect }.join(", ")
|
||||||
template_type = if partial
|
template_type = if partial
|
||||||
"partial"
|
"partial"
|
||||||
|
|
|
@ -251,4 +251,13 @@ class TestMissingTemplate < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
assert_match %r{Missing partial parent/foo, child/foo with .* Searched in:\n \* "/Path/to/views"\n}, e.message
|
assert_match %r{Missing partial parent/foo, child/foo with .* Searched in:\n \* "/Path/to/views"\n}, e.message
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue