Sha256: a7b342532004c0218d2b5110e77618525dfad81581bc7cb8d11a372bb42ed118

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

describe Weather::Units do
  describe 'constants' do
    it 'should have constants for celsius and farenheit' do
      expect(Weather::Units::FARENHEIT).to eq 'f'
      expect(Weather::Units::CELSIUS).to eq 'c'
    end
  end

  describe 'defaults', :vcr do
    it 'should default to imperial units' do
      response = Weather.lookup 9848

      expect(response.units.distance).to eq 'mi'
      expect(response.units.pressure).to eq 'in'
      expect(response.units.speed).to eq 'mph'
      expect(response.units.temperature).to eq 'F'
    end

    it 'should switch to metric if specified' do
      response = Weather.lookup 9848, 'c'

      expect(response.units.distance).to eq 'km'
      expect(response.units.pressure).to eq 'mb'
      expect(response.units.speed).to eq 'km/h'
      expect(response.units.temperature).to eq 'C'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
weather-api-1.1.1 spec/lib/units_spec.rb
weather-api-1.1.0 spec/lib/units_spec.rb