Sha256: 5c43057faffc0c6c5ca4eb44e07573e8ce28e1b635c520803f9ee63dc63a7bd9

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'minitest/autorun'
require './lib/weatherscout.rb'

CITY = "新竹"
weather = DailyWeatherScraper::DailyWeather.new(CITY)

describe 'Daily weather desc scrap' do
  it 'should return date with the "month/day" style' do
    city = weather.city
    city.must_be_instance_of String
  end

  it 'should return date with the "month/day" style' do
    date = weather.date
    date.must_match /\d\d\/\d\d/
  end

  it 'should return temperature in daytime' do
    temp = weather.temperature_day
    temp.must_match /(-|\d)\d+\s~\s(-|\d)\d+/
  end

  it 'should return temperature in nighttime' do
    temp = weather.temperature_night
    temp.must_match /(-|\d)\d+\s~\s(-|\d)\d+/
  end

  it 'should return weather condition in daytime' do
    con = weather.condition_day
    con.must_be_instance_of String
  end

  it 'should return weather condition in nighttime' do
    con = weather.condition_night
    con.must_be_instance_of String
  end

  it 'should return rain probaliity' do
    prob = weather.rain_probability
    prob.must_match /\d+\s%/
  end

  it 'should return weather tips' do
    tips = weather.tips
    tips.must_be_instance_of String
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
weatherscout-0.1.1 spec/weatherdesc_spec.rb