require 'test_helper'

class LocotimezoneErrorsTest < Minitest::Test

  describe 'testing error handling' do
    it 'must be empty if bad request' do
      result = Locotimezone.locotime address: ''
      assert true, result[:geo].empty?
      assert true, result[:timezone].empty?
    end

    it 'must be empty if no location if found' do
      result = Locotimezone.locotime address: '%'
      assert true, result[:geo].empty?
      assert true, result[:timezone].empty?
    end

    it 'must be empty if location is not a hash' do
      result = Locotimezone.locotime location: '%', timezone_only: true
      assert true, result[:timezone].empty?
    end

    it 'must be empty if location returns bad request' do
      result = Locotimezone.locotime location: { lat: 'bob', lng: 'loblaw' }, 
        timezone_only: true
      assert true, result[:timezone].empty?
    end

    it 'raises argument error if no address is given' do
      assert_raises(ArgumentError) { Locotimezone.locotime }
    end

    it 'raises argument error if no location is given when timezone only' do
      assert_raises ArgumentError do 
        Locotimezone.locotime timezone_only: true 
      end
    end

  end
end

require 'test_helper'

class LocotimezoneErrorsTest < Minitest::Test

  describe 'testing error handling' do
    it 'must be empty if getting location returns bad request' do
      result = Locotimezone.locotime address: ''
      assert true, result[:geo].empty?
      assert true, result[:timezone].empty?
    end

    it 'must be empty if no location if found' do
      result = Locotimezone.locotime address: '%'
      assert true, result[:geo].empty?
      assert true, result[:timezone].empty?
    end

    it 'must be empty if location is not a hash' do
      result = Locotimezone.locotime location: '%', timezone_only: true
      assert true, result[:timezone].empty?
    end

    it 'must be empty if getting timezone returns bad request' do
      result = Locotimezone.locotime location: { lat: 'bob', lng: 'loblaw' }, 
        timezone_only: true
      assert true, result[:timezone].empty?
    end

    it 'raises argument error if no address is given' do
      assert_raises(ArgumentError) { Locotimezone.locotime }
    end

    it 'raises argument error if no location is given when timezone only' do
      assert_raises ArgumentError do 
        Locotimezone.locotime timezone_only: true 
      end
    end

  end
end

Update error test assertions to make them more informative as to what is being tested.
Update error test assertions to make them more informative as to what is being
tested.
