Throws an ArgumentError, if no template fits given types
This commit is contained in:
parent
67dd2aa4d5
commit
74bbc7f186
|
@ -129,6 +129,9 @@ module Zero
|
|||
return Tilt.new(template)
|
||||
end
|
||||
end
|
||||
raise ArgumentError.new(
|
||||
"No template found for any of this types #{types.join ', '}!"
|
||||
)
|
||||
end
|
||||
raise ArgumentError.new "No template found for '#{name}'!"
|
||||
end
|
||||
|
|
|
@ -10,6 +10,7 @@ describe Zero::Renderer, '#render' do
|
|||
}}
|
||||
let(:html_types) { ['text/html'] }
|
||||
let(:json_types) { ['application/json'] }
|
||||
let(:foo_types) { ['foo/bar', 'bar/foo'] }
|
||||
let(:binding) { SpecTemplateContext.new('foo') }
|
||||
|
||||
before :each do
|
||||
|
@ -37,4 +38,13 @@ describe Zero::Renderer, '#render' do
|
|||
subject.render('foobar', html_types, binding)
|
||||
}.to raise_error(ArgumentError, "No template found for 'foobar'!")
|
||||
end
|
||||
|
||||
it 'returns an ArgumentError, if no template fits types' do
|
||||
expect {
|
||||
subject.render('index', foo_types, binding)
|
||||
}.to raise_error(
|
||||
ArgumentError,
|
||||
"No template found for any of this types #{foo_types.join ', '}!"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue