Sha256: 5355cd67be68101fd8735c6120f40c103383d779a5705fb391bb59c19574ecdf

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

Contents

require 'spec_helper'

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

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

      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

    it 'should switch to imperial if specified' do
      response = Weather.lookup 9848, Weather::Units::FAHRENHEIT

      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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
weather-api-1.4.0 spec/lib/units_spec.rb
weather-api-1.3.0 spec/lib/units_spec.rb
weather-api-1.2.0 spec/lib/units_spec.rb