Sha256: 18cf2c68f61292139ab1880f05afd64418196e19c93018b08318b504aed847e0

Contents?: true

Size: 512 Bytes

Versions: 6

Compression:

Stored size: 512 Bytes

Contents

require 'spec_helper'


RSpec.describe Yaks::FP::HashUpdatable do
  let(:klz) do
    Class.new do
      include Equalizer.new(:aa, :bb, :cc)
      include Yaks::FP::HashUpdatable.new(:aa, :bb, :cc)

      attr_reader :aa, :bb, :cc
      private :aa

      def initialize(opts)
        @aa, @bb, @cc = opts.values_at(:aa, :bb, :cc)
      end
    end
  end

  it 'should only update the selected fields' do
    expect(klz.new(aa: 1, bb: 2, cc: 3).update(bb: 7, cc: 9)).to eq klz.new(aa: 1, bb: 7, cc: 9)
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
yaks-0.6.0.alpha.1 spec/unit/yaks/fp/hash_updatable_spec.rb
yaks-html-0.6.0.alpha yaks/spec/unit/yaks/fp/hash_updatable_spec.rb
yaks-0.6.0.alpha yaks/spec/unit/yaks/fp/hash_updatable_spec.rb
yaks-0.5.0 spec/unit/yaks/fp/hash_updatable_spec.rb
yaks-0.4.4 spec/unit/yaks/fp/hash_updatable_spec.rb
yaks-0.4.3 spec/unit/yaks/fp/hash_updatable_spec.rb