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