Sha256: 1a24d297071901186777ac2ba62c2f94b23f3267ce3db34c9ddebcdc191ddf34

Contents?: true

Size: 548 Bytes

Versions: 10

Compression:

Stored size: 548 Bytes

Contents

require 'spec_helper'

RSpec.describe Yaks::Configurable do
  class Creatable
    def self.create(*args, &block)
      ["->", *args, block.call]
    end
  end

  subject do
    Class.new do
      include Yaks::Attributes.new(foo: []), Yaks::Configurable

      config_method :bar, append_to: :foo, create: Creatable
    end
  end

  it 'should generate the config method' do
    expect(
      subject.new.bar(1,2,3) { 4 }
                 .bar(:baz)  { :booz }
                 .foo
    ).to eql [["->", 1, 2, 3, 4], ["->", :baz, :booz]]
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
yaks-0.7.6 spec/unit/yaks/configurable_spec.rb
yaks-0.7.5 spec/unit/yaks/configurable_spec.rb
yaks-0.7.4 spec/unit/yaks/configurable_spec.rb
yaks-0.7.3 spec/unit/yaks/configurable_spec.rb
yaks-0.7.2 spec/unit/yaks/configurable_spec.rb
yaks-0.7.1 spec/unit/yaks/configurable_spec.rb
yaks-0.7.0 spec/unit/yaks/configurable_spec.rb
yaks-0.6.2 spec/unit/yaks/configurable_spec.rb
yaks-0.6.1 spec/unit/yaks/configurable_spec.rb
yaks-0.6.0 spec/unit/yaks/configurable_spec.rb