Sha256: 4679d72b8ae9028e5d9140a1f8eb2ec689283f62262c3fddb00094ad5a629bfa
Contents?: true
Size: 1.78 KB
Versions: 6
Compression:
Stored size: 1.78 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' describe Slippers::TemplateGroupDirectory do it 'should find the file in the directory folder' do template_group = Slippers::TemplateGroupDirectory.new('spec/views') template_group.find('index').should eql(Slippers::Engine.new('Hey foo', :template_group => template_group)) template_group.find('person/age').should eql(Slippers::Engine.new('The age for him is $age$', :template_group => template_group)) end it 'should return nil if it cannot find the file in the directory folder' do template_group = Slippers::TemplateGroupDirectory.new('spec/views') template_group.find('person/not_found').should eql(nil) end it 'should read the st template file and return a new slipers engine for it' do template_group = Slippers::TemplateGroupDirectory.new('spec/views') template_group.find('index').should eql(Slippers::Engine.new('Hey foo', :template_group => template_group)) template_group.find('person/age').should eql(Slippers::Engine.new('The age for him is $age$', :template_group => template_group)) end it 'should load the ruby file found in the directory folder' do template_group = Slippers::TemplateGroupDirectory.new('spec/views') template_group.find('person/date_renderer').class.should eql(DateRenderer) template_group.find('money').class.should eql(Money) end it 'should look in the super template group if it cannot find the template' do template = stub 'template' super_template_group = Slippers::TemplateGroup.new(:templates => {:person => template}) template_group = Slippers::TemplateGroupDirectory.new('spec/views', :super_group => super_template_group) template_group.find('person').should eql(template) template_group.find('not_this').should eql(nil) end end
Version data entries
6 entries across 6 versions & 1 rubygems