Sha256: cc0a0d0a28198e517006f9ef7f9bd835f477274ba6cc525b277f7aa7c9e35ec2

Contents?: true

Size: 887 Bytes

Versions: 7

Compression:

Stored size: 887 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Options do
  context '#destination' do
    it 'returns an io handle' do
      template_file = create_file('template.erb')
      options = Options.new([template_file])
      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
      expect { Options.new(['template_file']) }.to raise_error Exceptions::TemplateDoesNotExist
    end

    it 'raises an exception if file does not have a erb-extension' do
      template_file = create_file('template')
      expect { Options.new([template_file]) }.to raise_error Exceptions::TemplateNameIsInvalid
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
filegen-0.4.3 spec/options_spec.rb
filegen-0.4.1 spec/options_spec.rb
filegen-0.4.0 spec/options_spec.rb
filegen-0.3.1 spec/options_spec.rb
filegen-0.3.0 spec/options_spec.rb
filegen-0.2.3 spec/options_spec.rb
filegen-0.2.2 spec/options_spec.rb