Sha256: 2d74ed9f22a07dc1cc6a2b43df7f47202103d23215597863352f861db0c4d781

Contents?: true

Size: 681 Bytes

Versions: 6

Compression:

Stored size: 681 Bytes

Contents

require 'spec_helper'
require 'dm_ruby_extensions'

describe NilClass do

  describe 'to_s_default' do
    it 'returns default string' do
      expect(nil.to_s_default).to eq 'n/a'
      expect(nil.to_s_default('--')).to eq '--'
    end
  end

  describe 'as_boolean' do
    specify { expect(nil.as_boolean).to eq false }
  end
  
  describe 'to_age' do
    specify { expect(nil.to_age).to eq 0}
  end

  describe 'sql_wildcard' do
    specify { expect(nil.sql_wildcard).to eq '%' }
  end

  describe 'utc' do
    specify { expect(nil.utc).to eq '' }
  end
  
  describe '+(y)' do
    specify { expect(nil + 12).to eq 12 }
    specify { expect(nil + 'foo').to eq 'foo' }
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dm_ruby_extensions-1.0.9 spec/extensions/nil_spec.rb
dm_ruby_extensions-1.0.8 spec/extensions/nil_spec.rb
dm_ruby_extensions-1.0.7 spec/extensions/nil_spec.rb
dm_ruby_extensions-1.0.6 spec/extensions/nil_spec.rb
dm_ruby_extensions-1.0.5 spec/extensions/nil_spec.rb
dm_ruby_extensions-1.0.0 spec/extensions/nil_spec.rb