Sha256: 7d8bd57bd6dce855f711f945afe09eab0fd145828430698d2d4da00da5543369

Contents?: true

Size: 825 Bytes

Versions: 3

Compression:

Stored size: 825 Bytes

Contents

require 'mida/datatype'

describe Mida::DataType::Boolean do

  it '#extract should raise an exception if some other text' do
    test = lambda {Mida::DataType::Boolean.extract('hello')}
    test.should raise_error(ArgumentError)
  end

  it '#extract should raise an exception if value is empty' do
    test = lambda {Mida::DataType::Boolean.extract('')}
    test.should raise_error(ArgumentError)
  end

  it '#extract should return true for "True" whatever the case' do
    ['true', 'True', 'TRUE', 'tRUE'].each do |true_text|
      Mida::DataType::Boolean.extract(true_text).should be_true
    end
  end

  it '#extract should return false for "False" whatever the case' do
    ['false', 'False', 'FALSE', 'fALSE'].each do |false_text|
      Mida::DataType::Boolean.extract(false_text).should be_false
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mida-0.3.2 spec/datatype/boolean_spec.rb
mida-0.3.1 spec/datatype/boolean_spec.rb
mida-0.3.0 spec/datatype/boolean_spec.rb