Commit a0f74c90 by Ivan Lan

Merge branch 'lan/update_warning_district_ohm_index' into 'master'

Lan/update warning district ohm index See merge request !16
parents b3b6e42c 939065e5
...@@ -11,8 +11,8 @@ module WeatherModel ...@@ -11,8 +11,8 @@ module WeatherModel
unit: :string unit: :string
}, },
options: { options: {
index: [:publishtime, :unit], index: [:publishtime, :level, :unit],
expire: 11 * 24 * 60 * 60, expire: 2 * 24 * 60 * 60,
unique: nil, unique: nil,
belongs_to: nil, belongs_to: nil,
has_many: nil, has_many: nil,
......
...@@ -33,15 +33,15 @@ RSpec.describe WeatherModel do ...@@ -33,15 +33,15 @@ RSpec.describe WeatherModel do
end end
it 'Test factory_girl' do it 'Test factory_girl' do
expect(@obj.class).to eq(Forecast::CityForecast), 'factory_girl 生成成功' expect(@obj.class).to eq(::WeatherModel::Forecast::CityForecast), 'factory_girl 生成成功'
end end
end end
it 'Forecast' do it 'Forecast' do
@expire = 1 @expire = 1
mysql = Forecast::CityForecast mysql = ::WeatherModel::Forecast::CityForecast
ohm = ohm ohm = ::WeatherModel::Forecast::CityForecast::Ohm
ohm.expire @expire ohm.expire @expire
mysql_obj = mysql.create({ mysql_obj = mysql.create({
datetime: '2017-05-16', datetime: '2017-05-16',
...@@ -66,7 +66,7 @@ RSpec.describe WeatherModel do ...@@ -66,7 +66,7 @@ RSpec.describe WeatherModel do
end end
it 'aqi_forecast' do it 'aqi_forecast' do
@aqi_forecast = Aqi::AqiForecast.create( @aqi_forecast = ::WeatherModel::Aqi::AqiForecast.create(
datetime: Time.now, datetime: Time.now,
prompt: '', prompt: '',
list: [ list: [
...@@ -83,8 +83,8 @@ RSpec.describe WeatherModel do ...@@ -83,8 +83,8 @@ RSpec.describe WeatherModel do
}, },
] ]
) )
expect(Aqi::AqiForecast.all.first.list.class).to eq(Array), 'Mysql json_column 正常' expect(::WeatherModel::Aqi::AqiForecast.all.first.list.class).to eq(Array), 'Mysql json_column 正常'
expect(Aqi::AqiForecast::Ohm.all.first.list.class).to eq(Array), 'Ohm json_column 正常' expect(::WeatherModel::Aqi::AqiForecast::Ohm.all.first.list.class).to eq(Array), 'Ohm json_column 正常'
end end
describe 'test Ohm # to_h' do describe 'test Ohm # to_h' do
......
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