Sha256: ef974147bcedbcfeb745b4f993d278ac637c1b4bcb73054a7fcb9aa9b4fad6b9

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

require 'beethoven/composer'

RSpec.describe Beethoven::Composer do
  # F :: () -> a
  class F
    attr_reader :a

    def initialize(o)
      @a = o
    end
  end

  # G :: a -> b
  class G
    attr_reader :b

    def initialize(o)
      @b = o.a
    end
  end

  # H :: b -> c
  class H
    attr_reader :c

    def initialize(o)
      @c = o.b
    end
  end

  subject { Beethoven::Composer }

  describe 'composes classes' do
    it 'transfers the value' do
      expect(subject.new(F, G, H).new(5).c).to eq(5)
    end

    it 'can take array of classes' do
      expect(subject.new([F, G, H]).new(5).c).to eq(5)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beethoven-0.1.0 spec/beethoven/composer_spec.rb