Sha256: a99ba43c9631288902f8b73c66275c6f7f73594eb66d6195254ffe868f845dad

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

require 'spec_helper'

describe Id::Boolean do
  it 'parses the word true as true' do
    b = Id::Boolean.parse('true')
    expect(b).to be_true
  end

  it 'parses the word yes as true' do
    b = Id::Boolean.parse('yes')
    expect(b).to be_true
  end

  it 'is case insensite when parsing a string' do
    b = Id::Boolean.parse('tRuE')
    expect(b).to be_true
  end

  it 'parses the character 1 as true' do
    b = Id::Boolean.parse('1')
    expect(b).to be_true
  end

  it 'parses the number 1 as true' do
    b = Id::Boolean.parse(1)
    expect(b).to be_true
  end

  it 'parses symbols as well as strings' do
    b = Id::Boolean.parse(:true)
    expect(b).to be_true
  end

  it 'parses everything else as false' do
    b = Id::Boolean.parse(:cottage_cheese)
    expect(b).to be_false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
id-0.1 spec/lib/id/boolean_spec.rb