Sha256: bcdf8d599b881d28d6ade83c3b7fc9f9a793773225f314b848f44bdfe260c3d4
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' class InterpolateSpec include New::Interpolate end describe New::Interpolate do let(:template_dir){ root('spec', 'fixtures', 'templates', 'foo_template') } before do # don't use let. since interpolate creates files, we only want to generate files once to test aginst. @obj = InterpolateSpec.new @obj.interpolate(template_dir, { 'foo' => { 'bar' => 'baz' } }) end after do FileUtils.rm_rf @obj.dir end it 'should process and rename .erb files' do # check that files exist expect(File.exists?(File.join(@obj.dir, 'foo_template', 'baz.txt'))).to eq true expect(File.exists?(File.join(@obj.dir, 'foo_template', 'nested_baz', 'foo.txt'))).to eq true # check their content has been processed expect(File.open(File.join(@obj.dir, 'foo_template', 'baz.txt')).read).to include 'foo baz' expect(File.open(File.join(@obj.dir, 'foo_template', 'nested_baz', 'foo.txt')).read).to include 'foo baz' end it 'should create dot notation accessible options' do expect(@obj.dot_options.foo.bar).to eq('baz') end it 'should respond to options as methods' do expect(@obj.foo.bar).to eq 'baz' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
new-0.0.5 | spec/lib/new/interpolate_spec.rb |