Sha256: 3c32c8c4e8b44974183edcc055af20154e5b15aba7a61ccdd26ebf5fd96d4d13

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

require 'helper'

describe WorldbankAsDataframe::DataQuery do
  context 'lending types' do
    it 'accepts a single LendingType as param' do
      stub_get('lendingTypes/IDB/indicators/all?format=json')
      lending_type = WorldbankAsDataframe::LendingType.new({"id" => "IDB","value" => "Blend"})
      WorldbankAsDataframe::Data.raw.lending_type(lending_type).fetch
      a_get('lendingTypes/IDB/indicators/all?format=json').should have_been_made
    end
  end
  context 'income levels' do
    it 'accepts a single IncomeLevels as param' do
      stub_get('incomeLevels/LMC/indicators/all?format=json')
      WorldbankAsDataframe::Data.raw.income_level('LMC').fetch
      a_get('incomeLevels/LMC/indicators/all?format=json').should have_been_made
    end
  end
  context 'sources' do
    it 'accepts a single Source as param' do
      stub_get('sources/1/indicators/all?format=json')
      WorldbankAsDataframe::Data.raw.source(1).fetch
      a_get('sources/1/indicators/all?format=json').should have_been_made
    end
  end
  context 'country' do
    it 'adds countries to the params if given ISO-2 code' do
      stub_get('countries/br/indicators/AB.LND.ARBL.ZS?format=json')
      WorldbankAsDataframe::Data.find('AB.LND.ARBL.ZS').country('br').raw.fetch
      a_get('countries/br/indicators/AB.LND.ARBL.ZS?format=json').should have_been_made
    end
    it 'adds countries to the params if given human name' do
      stub_get('countries/BR/indicators/AB.LND.ARBL.ZS?format=json')
      WorldbankAsDataframe::Data.find('AB.LND.ARBL.ZS').country('brazil').raw.fetch
      a_get('countries/BR/indicators/AB.LND.ARBL.ZS?format=json').should have_been_made
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
worldbank_as_dataframe-0.2.1 spec/worldbank_as_dataframe/data_query_spec.rb
worldbank_as_dataframe-0.2 spec/worldbank_as_dataframe/data_query_spec.rb
worldbank_as_dataframe-0.1.1 spec/worldbank_as_dataframe/data_query_spec.rb
worldbank_as_dataframe-0.1.0 spec/worldbank_as_dataframe/data_query_spec.rb