Sha256: 31b4a8deac0a092b576a4f9a772529e3e53aa51e389f51842375905560269409

Contents?: true

Size: 502 Bytes

Versions: 8

Compression:

Stored size: 502 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/patches/object/if_present'

RSpec.describe ::Object do
  context '#if_present' do
    it { expect(nil.if_present).to eq(nil) }
    it { expect(nil.if_present('default')) .to eq('default') }
    it { expect(nil.if_present('default') { |_v| 'calculated' }).to eq('default') }
    it { expect('present'.if_present('default')).to eq('present') }
    it { expect('present'.if_present { |v| v + '_calculated' }) .to eq('present_calculated') }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ehbrs-tools-0.11.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
ehbrs-tools-0.10.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
ehbrs-tools-0.9.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
ehbrs-tools-0.7.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
ehbrs-tools-0.6.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
ehbrs-tools-0.5.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
ehbrs-tools-0.3.1 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb
ehbrs-tools-0.3.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb