Sha256: 1115c2dd835e93f61356e66f3e6864ac7768e795b0099a0d142c77079e483f66

Contents?: true

Size: 720 Bytes

Versions: 4

Compression:

Stored size: 720 Bytes

Contents

require 'spec_helper'
module Alf
  module Support
    describe Config, "merge" do

      let(:config_class){
        Class.new(Config){ 
          option :ready, Boolean, true
          option :hello, String, "world"
        }
      }
      let(:config){ config_class.new }

      subject{ config.merge(ready: false) }

      it{ should be_a(config_class) }

      it 'is not the original' do
        subject.should_not be(config)
      end

      it 'merges the new options' do
        subject.ready?.should eq(false)
        subject.hello.should eq("world")
      end

      it 'does not touch the original' do
        config.ready?.should eq(true)
        config.hello.should eq("world")
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-support/config/test_merge.rb
alf-core-0.14.0 spec/unit/alf-support/config/test_merge.rb
alf-core-0.13.1 spec/unit/alf-support/config/test_merge.rb
alf-core-0.13.0 spec/unit/alf-support/config/test_merge.rb