Sha256: dfa9b151733bab6b83abd63ac4d53673008a148339a4cd14e2c1a0ae3ec36181

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

require 'spec_helper'

require 'transproc/coercions'

describe 'Transproc / Coercions' do
  describe 'to_string' do
    it 'turns integer into a string' do
      expect(Transproc(:to_string)[1]).to eql('1')
    end
  end

  describe 'to_integer' do
    it 'turns string into an integer' do
      expect(Transproc(:to_integer)['1']).to eql(1)
    end
  end

  describe 'to_float' do
    it 'turns string into a float' do
      expect(Transproc(:to_float)['1']).to eql(1.0)
    end

    it 'turns integer into a float' do
      expect(Transproc(:to_float)[1]).to eql(1.0)
    end
  end

  describe 'to_date' do
    it 'turns string into a date' do
      date = Date.new(1983, 11, 18)
      expect(Transproc(:to_date)['18th, November 1983']).to eql(date)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transproc-0.0.1 spec/integration/coercions_spec.rb