Sha256: f4ab642d0217acfc5c94859ecbf27235591781648c53ad20c59c40a5d1508125

Contents?: true

Size: 846 Bytes

Versions: 4

Compression:

Stored size: 846 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Options do
  context '#destination' do
    it 'returns an io handle' do
      options = Options.new([])
      expect(options.destination).to respond_to(:puts)
    end
  end

  context '#source' do
    it 'returns an io handle' do
      template_file = create_file('template.erb')

      options = Options.new([template_file])
      expect(options.source).to respond_to(:read)
    end

    it 'raises an exception if file does not exist' do
      options = Options.new(['template_file'])
      expect { options.source }.to raise_error RuntimeError
    end

    it 'raises an exception if file does not have a erb-extension' do
      template_file = create_file('template')

      options = Options.new([template_file])
      expect { options.source }.to raise_error RuntimeError
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
filegen-0.2.1 spec/options_spec.rb
filegen-0.2.0 spec/options_spec.rb
filegen-0.1.2 spec/options_spec.rb
filegen-0.1.1 spec/options_spec.rb