Sha256: dbc21a325a6b3b1355ecc20db403097d77869e1e975857108e1ab839701f9063
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
# encoding: UTF-8 require 'simplecov' and SimpleCov.start do add_filter "spec/" end require 'mojito' describe Mojito::Rendering::Templates do context 'inline templates' do subject do Mojito.base_application Mojito::Rendering::Templates do template :erb, 'before <%= var %> <%= yield %> after', :var => 'middle' do 'inside the block' end halt! end.mock_request end it { subject.get('/').status.should == 200 } it { subject.get('/').body.should == 'before middle inside the block after' } end context 'file templates' do subject do Mojito.base_application Mojito::Rendering::Templates do template 'test.html.erb', :var => 'middle' do 'inside the block' end halt! end.mock_request end it { subject.get('/').status.should == 200 } it { subject.get('/').body.should == 'HTML file with a variable middle and a yield inside the block' } it { subject.get('/').headers.should include('Content-Type') } it { subject.get('/').headers['Content-Type'].should == 'text/html' } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mojito-0.1.2 | spec/mojito/rendering/templates_spec.rb |
mojito-0.1.1 | spec/mojito/rendering/templates_spec.rb |