Sha256: 24fd054a0a66ccb89394f3db67dd9cc19267dd82493609374c6dad9603d4ce40

Contents?: true

Size: 682 Bytes

Versions: 1

Compression:

Stored size: 682 Bytes

Contents

require 'one_bus_away'

RSpec.describe OneBusAway::Utilities do
  describe '.convert_time' do
    it { expect(OneBusAway::Utilities).to respond_to(:convert_time) }

    # Format from OBA API is Time as integer * 1000
    it 'returns the correct format' do
      time = (Time.now + 240).to_i * 1000

      expect(OneBusAway::Utilities.convert_time(time))
        .to eq('4 minutes')
    end
  end

  describe '#strip_time' do
    it { expect(OneBusAway::Utilities.new).to respond_to(:strip_time) }
    it 'removes the last for characters' do
      time = '1445318245161'
      obj = OneBusAway::Utilities.new

      expect(obj.strip_time(time)).to eq('1445318245')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
one_bus_away-0.0.4 spec/utilities_spec.rb