Sha256: 826c2402d9c82b15e24ee7ef89ed8dde544a918fa5119aaadbb95ba6a6814aed
Contents?: true
Size: 1.11 KB
Versions: 4
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 that files exist expect(File.exists?(File.join(@obj.dir, 'baz.txt'))).to eq true expect(File.exists?(File.join(@obj.dir, 'nested_baz', 'foo.txt'))).to eq true # 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 end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
new-0.0.4 | spec/lib/new/interpolate_spec.rb |
new-0.0.3 | spec/lib/new/interpolate_spec.rb |
new-0.0.2 | spec/lib/new/interpolate_spec.rb |
new-0.0.0 | spec/lib/new/interpolate_spec.rb |