Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weather-model
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
weather-model
Commits
408f95c9
Commit
408f95c9
authored
May 21, 2017
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add aqi model spec
parent
c9ef0d17
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
aqi.rb
lib/weather-model/source_schemas/aqi.rb
+1
-1
weather-model_spec.rb
spec/weather-model_spec.rb
+8
-7
No files found.
lib/weather-model/source_schemas/aqi.rb
View file @
408f95c9
...
@@ -103,7 +103,7 @@ module WeatherModel
...
@@ -103,7 +103,7 @@ module WeatherModel
"pm2_5"
=>
32
,
"pm2_5"
=>
32
,
"pm2_5_24h"
=>
42
,
"pm2_5_24h"
=>
42
,
"position_name"
=>
"市政府"
,
"position_name"
=>
"市政府"
,
"primary_pollutant"
=>
n
ul
l
,
"primary_pollutant"
=>
n
i
l
,
"quality"
=>
"优"
,
"quality"
=>
"优"
,
"so2"
=>
10
,
"so2"
=>
10
,
"so2_24h"
=>
13
,
"so2_24h"
=>
13
,
...
...
spec/weather-model_spec.rb
View file @
408f95c9
require
"spec_helper"
require
"spec_helper"
require
'active_record'
require
'active_record'
require
"ohm"
require
"ohm"
Dir
[
File
.
dirname
(
__FILE__
)
+
'../lib/weather-model.rb'
].
each
{
|
file
|
require
file
}
include
WeatherModel
#
include WeatherModel
RSpec
.
describe
WeatherModel
do
RSpec
.
describe
WeatherModel
do
...
@@ -12,7 +13,7 @@ RSpec.describe WeatherModel do
...
@@ -12,7 +13,7 @@ RSpec.describe WeatherModel do
# run migration
# run migration
Dir
[
File
.
dirname
(
__FILE__
)
+
'/../db/migrate/*.rb'
].
each
{
|
file
|
require
file
}
Dir
[
File
.
dirname
(
__FILE__
)
+
'/../db/migrate/*.rb'
].
each
{
|
file
|
require
file
}
# drop table
# drop table
FileUtils
.
rm
'weather-model-test.sqlite3'
FileUtils
.
rm
_f
'weather-model-test.sqlite3'
ActiveRecord
::
Base
.
establish_connection
(
ActiveRecord
::
Base
.
establish_connection
(
:adapter
=>
'sqlite3'
,
:adapter
=>
'sqlite3'
,
:database
=>
'weather-model-test.sqlite3'
:database
=>
'weather-model-test.sqlite3'
...
@@ -46,7 +47,7 @@ RSpec.describe WeatherModel do
...
@@ -46,7 +47,7 @@ RSpec.describe WeatherModel do
temp_high:
'100'
,
temp_high:
'100'
,
temp_low:
'0'
,
temp_low:
'0'
,
weather_text1:
'酷热'
,
weather_text1:
'酷热'
,
weather_text
1
:
'严寒'
,
weather_text
2
:
'严寒'
,
weather_pic:
'http://xxx.com'
,
weather_pic:
'http://xxx.com'
,
win_dir:
'东南西北风'
,
win_dir:
'东南西北风'
,
win_speed:
'1级'
,
win_speed:
'1级'
,
...
@@ -86,10 +87,10 @@ RSpec.describe WeatherModel do
...
@@ -86,10 +87,10 @@ RSpec.describe WeatherModel do
it
'Test all source data'
do
it
'Test all source data'
do
[
[
Forecast
::
CityForecast
,
WeatherModel
::
Forecast
::
CityForecast
,
AutoStation
::
AutoStationTenMins
,
WeatherModel
::
AutoStation
::
AutoStationTenMins
,
Aqi
::
AqiForecast
,
WeatherModel
::
Aqi
::
AqiForecast
,
Aqi
::
RealtimeAqi
WeatherModel
::
Aqi
::
AqiLive
,
].
each
{
|
source
|
source
.
all
;
source
.
const_get
(
'Ohm'
).
all
}
].
each
{
|
source
|
source
.
all
;
source
.
const_get
(
'Ohm'
).
all
}
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment