Sha256: 0e7add3307b1c7ab2c571e29496a094a475a55d9f1dc97d12242b4ba54d1fee3

Contents?: true

Size: 955 Bytes

Versions: 11

Compression:

Stored size: 955 Bytes

Contents

require "#{File.dirname(__FILE__)}/test_helper"

describe EnrichmentDb::Helper do
  it 'should convert float str to float' do
    result = EnrichmentDb::Helper.float_str_to_float('26')
    assert_equal 26, result
  end

  it 'should not convert float str to float' do
    input = 's26'
    result = EnrichmentDb::Helper.float_str_to_float(input)
    assert_equal input, result
  end

  it 'should convert hash with float str values to float values' do
    input = { 'er' => '-26', 'rt' => '234567.43' }
    result = EnrichmentDb::Helper.hash_float_str_to_float(input)
    expecting = { 'er' => -26, 'rt' => 234567.43 }
    assert_equal expecting, result
  end

  it 'should partially convert hash with float str values to float values' do
    input = { 'er' => '-26', 'rt' => '23s4567.43' }
    result = EnrichmentDb::Helper.hash_float_str_to_float(input)
    expecting = { 'er' => -26, 'rt' => '23s4567.43' }
    assert_equal expecting, result
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
enrichment_db-0.1.15 test/helper_test.rb
enrichment_db-0.1.14 test/helper_test.rb
enrichment_db-0.1.13 test/helper_test.rb
enrichment_db-0.1.12 test/helper_test.rb
enrichment_db-0.1.11 test/helper_test.rb
enrichment_db-0.1.10 test/helper_test.rb
enrichment_db-0.1.9 test/helper_test.rb
enrichment_db-0.1.8 test/helper_test.rb
enrichment_db-0.1.7 test/helper_test.rb
enrichment_db-0.1.6 test/helper_test.rb
enrichment_db-0.1.5 test/helper_test.rb