Sha256: 9c9c4e6c8b79a644c24f5c2a4019d128db0affb9bbd510506347f0dabf6e17bb
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 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 their content has been processed expect(File.open(File.join(@obj.dir, 'baz.txt')).read).to include 'foo baz' expect(File.open(File.join(@obj.dir, '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 describe '#friendly_filename' do it 'should convert a string to a unix compatible filename' do expect(@obj.to_filename('Foo Bar')).to eq 'foo_bar' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
new-0.1.1 | spec/lib/new/interpolate_spec.rb |
new-0.0.15 | spec/lib/new/interpolate_spec.rb |