Commit f97227b0 by ivan Lan

Add spec for Aqi::Forecast

parent b1e5b04d
...@@ -61,6 +61,27 @@ RSpec.describe WeatherModel do ...@@ -61,6 +61,27 @@ RSpec.describe WeatherModel do
expect(Forecast::CityForecast::Ohm.all.count).to eq(0), 'TTL过期对象删除成功' expect(Forecast::CityForecast::Ohm.all.count).to eq(0), 'TTL过期对象删除成功'
end end
it 'aqi_forecast' do
@aqi_forecast = Aqi::Forecast.create(
datetime: Time.now,
prompt: '',
list: [
{
"period"=>"今天夜间(20时—06时)",
"aqi"=>"35-55",
"level"=>"优到良",
"pripoll"=>"PM10"
}, {
"period"=>"明天上午(06时—12时)",
"aqi"=>"35-55",
"level"=>"优到良",
"pripoll"=>"PM10"
},
]
)
expect(Aqi::Forecast::Ohm.all.first).not_to be_nil, 'json_column 正常'
end
after do after do
ActiveRecord::Migration[5.0].subclasses.each do |migrate| ActiveRecord::Migration[5.0].subclasses.each do |migrate|
migrate.migrate(:down) migrate.migrate(:down)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment