Sha256: b0481aed077c07b1ddd15ec3a1732de1658f3b1205ffdd63017384988372c692
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe Quarto::Rendering do context '.render' do it 'should use the ERB template' do template = ERB.new 'foo bar' Quarto::Rendering.render(template, {}).should == 'foo bar' end it 'should set the local variables' do template = ERB.new 'The value of x is <%= x %>.' Quarto::Rendering.render(template, {:x => 42}).should == 'The value of x is 42.' end it 'should mix in the modules' do module SomeMixin def foo; 42; end end template = ERB.new 'SomeMixin#foo returns <%= foo %>.' Quarto::Rendering.render(template, {}, [SomeMixin]).should == 'SomeMixin#foo returns 42.' Object.class_eval do remove_const :SomeMixin end end it 'should raise ArgumentError if the first parameter is not an ERB template' do lambda { Quarto::Rendering.render('foo bar', {}) }.should raise_error(ArgumentError) end it 'should raise ArgumentError if the second parameter is not a hash' do template = ERB.new 'foo bar' lambda { Quarto::Rendering.render(template, [:x, 42]) }.should raise_error(ArgumentError) end it 'should raise ArgumentError if the third parameter is not an array of modules' do module SomeMixin; end template = ERB.new 'foo bar' lambda { Quarto::Rendering.render(template, {}, SomeMixin) }.should raise_error(ArgumentError) lambda { Quarto::Rendering.render(template, {}, [SomeMixin, 'foo']) }.should raise_error(ArgumentError) Object.class_eval do remove_const :SomeMixin end end end context '#output_file_path' do it 'should return the path' do rendering = Quarto::Rendering.new(ERB.new('foo'), {}, [], 'bar/baz') rendering.send(:output_file_path).should == 'bar/baz' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jarrett-quarto-1.6.0 | spec/rendering_spec.rb |