Sha256: e4737b90fbd42c88e369187a94bb5cc3b5f01cb1339ab5b7a0eb94925e2ede4d

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

require_relative '../spec_helper'
require_relative '../../lib/kamerling/value'

module Kamerling
  describe Value do
    describe '.new' do
      it 'creates a class with value semantics' do
        address = Class.new(Value) { vals street: String }
        address.new(street: 'Folsom').must_equal address.new(street: 'Folsom')
        address.new(street: 'Folsom').wont_equal address.new(street: 'Fair')
      end
    end

    describe '.vals' do
      it 'allows defining values in a key → class manner' do
        address = Class.new(Value) { vals street: String, country: String }
        address.attribute_set.map(&:name).must_equal %i(street country)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kamerling-0.0.3 spec/kamerling/value_spec.rb