Sha256: c3617d611b9d73f068702bd1226cddf70ed0128a6ef0ea8af197907204f9695d
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
# encoding : UTF-8 require 'rubygems' gem 'shoulda' require 'test/unit' require 'shoulda' require 'skiplan_client' require 'skiplan_client/weather_object' class SkiplanClientTest < Test::Unit::TestCase should 'test nokogiri open and xpath text function' do xml = Nokogiri::XML(open('http://api.openweathermap.org/data/2.5/forecast/daily?q=tokyo&mode=xml&units=metric&cnt=1')) city = xml.xpath('//name').text country = xml.xpath('//country').text assert_equal 'Tokyo', city assert_equal 'JP', country end should 'test get_weather founction' do config = SkiplanClient.configure('C:\Users\Simon\Desktop\Stage\GitHub\skiplan_client\data\lumi_response.xml') weather = SkiplanClient.get_weather assert_equal '101' , weather.auj_ciel_id_matin assert_equal '101' , weather.auj_ciel_id_apm assert_equal '104' , weather.dem_ciel_id_matin assert_equal '106' , weather.dem_ciel_id_apm assert_equal '+12' , weather.auj_temp_matin assert_equal '+20' , weather.auj_temp_apm assert_equal '+17' , weather.dem_temp_matin assert_equal '+21' , weather.dem_temp_apm end should 'change config url' do config = SkiplanClient.configure('http://api.openweathermap.org/data/2.5/forecast/daily?q=tokyo&mode=xml&units=metric&cnt=1') assert_equal 'http://api.openweathermap.org/data/2.5/forecast/daily?q=tokyo&mode=xml&units=metric&cnt=1', config end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
skiplan_client-0.0.4 | test/skiplan_client/skiplan_client_test.rb |