Kill all mutants in Zero::Renderer
This commit is contained in:
parent
e81dff9c07
commit
2c558846ec
|
@ -125,7 +125,8 @@ module Zero
|
|||
types.each do |type|
|
||||
template = templates[name][type]
|
||||
unless template.nil?
|
||||
return template if template.kind_of?(Tilt::Template)
|
||||
# TODO Will be implemented later
|
||||
# return template if template.kind_of?(Tilt::Template)
|
||||
return Tilt.new(template)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<%= name %>
|
|
@ -6,7 +6,13 @@ describe Zero::Renderer, 'read_template_path!' do
|
|||
let(:file_list) { ['foo/welcome/index.html.erb'] }
|
||||
|
||||
before :each do
|
||||
subject.stub(:search_files).and_return(file_list)
|
||||
Dir.stub(:[]) do |arg|
|
||||
if arg == 'foo/**/*.*'
|
||||
file_list
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'a template loader' do
|
||||
|
@ -50,4 +56,11 @@ describe Zero::Renderer, 'read_template_path!' do
|
|||
|
||||
it_behaves_like 'a template loader'
|
||||
end
|
||||
|
||||
it 'creates an empty templates list without templates in path' do
|
||||
subject = Zero::Renderer.new("bar", {})
|
||||
subject.read_template_path!
|
||||
|
||||
subject.templates.should eq({})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,6 @@ require 'spec_helper'
|
|||
describe Zero::Renderer, '#render' do
|
||||
subject { Zero::Renderer.new(template_path, type_map) }
|
||||
let(:template_path) { 'spec/fixtures/templates' }
|
||||
let(:file_list) { ['./foo/welcome/index.html.erb'] }
|
||||
let(:type_map) {{
|
||||
'html' => ['text/html', 'text/xml', '*/*'],
|
||||
'json' => ['application/json', 'plain/text']
|
||||
|
@ -47,4 +46,9 @@ describe Zero::Renderer, '#render' do
|
|||
"No template found for any of this types #{foo_types.join ', '}!"
|
||||
)
|
||||
end
|
||||
|
||||
it 'uses the context' do
|
||||
subject.render('context', html_types, binding).should match('foo')
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,4 +6,8 @@ describe Zero::Renderer, '#type_map' do
|
|||
let(:type_map) { {'html' => ['text/html']} }
|
||||
|
||||
its(:type_map) { should be(type_map) }
|
||||
|
||||
it 'returns an empty Hash, if type_map is not set while initialization' do
|
||||
Zero::Renderer.new(template_path).type_map.should eq({})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue