Sha256: 58faa6a612551b179958d47d0e44d094e5d5aba9c8b574ca3a8600d324a8be69

Contents?: true

Size: 846 Bytes

Versions: 5

Compression:

Stored size: 846 Bytes

Contents

require 'spec_helper'

module Skellington
  describe Template do
    before :each do
      @t = Template.new 'Rakefile'
      @t.params = { filename: 'dummy_gem' }
    end

    it 'has a name' do
      expect(@t.name).to eq 'Rakefile'
    end

    it 'takes variables' do
      expect(@t.params[:filename]).to eq 'dummy_gem'
    end

    it 'produces output' do
      expect(@t.to_s).to match /require File.join\(File.dirname\(__FILE__\), 'lib\/dummy_gem.rb'\)/
    end

    it 'writes to a file' do
      @t.outpath = 'tmp/Rakefile'
      @t.write
      expect(File).to exist 'tmp/Rakefile'
    end

    it 'behaves well with a more complex name' do
      @t = Template.new 'features/first.feature'
      @t.outpath = 'tmp/features/dummy_gem.feature'
      @t.write
      expect(File).to exist 'tmp/features/dummy_gem.feature'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
skellington-0.0.7 spec/template_spec.rb
skellington-0.0.6 spec/template_spec.rb
skellington-0.0.5 spec/template_spec.rb
skellington-0.0.4 spec/template_spec.rb
skellington-0.0.2 spec/template_spec.rb