Sha256: ef1d5298545e129e8d269528db0b1258d042c8edcf9df2a37da9ffb0c1e34402

Contents?: true

Size: 738 Bytes

Versions: 11

Compression:

Stored size: 738 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe ErbGenerator do
  context '#compile' do
    it 'needs a source and a target' do
      data = double('binding')
      allow(data).to receive(:instance_binding) do
        Class.new do
          def name
            'Karl'
          end

          def instance_binding
            binding
          end
        end.new.instance_binding
      end

      source = double('source')
      allow(source).to receive(:encoding)
      allow(source).to receive(:read).and_return('Hello <%= name %>')

      destination = double('destination')
      expect(destination).to receive(:puts).with('Hello Karl')

      gen = ErbGenerator.new(data)
      gen.compile(source, destination)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
filegen-0.4.3 spec/erb_generator_spec.rb
filegen-0.4.1 spec/erb_generator_spec.rb
filegen-0.4.0 spec/erb_generator_spec.rb
filegen-0.3.1 spec/erb_generator_spec.rb
filegen-0.3.0 spec/erb_generator_spec.rb
filegen-0.2.3 spec/erb_generator_spec.rb
filegen-0.2.2 spec/erb_generator_spec.rb
filegen-0.2.1 spec/erb_generator_spec.rb
filegen-0.2.0 spec/erb_generator_spec.rb
filegen-0.1.2 spec/erb_generator_spec.rb
filegen-0.1.1 spec/erb_generator_spec.rb