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
da693bf7
Commit
da693bf7
authored
May 15, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test to updating mysql obj
parent
2dc79236
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
weather-model_spec.rb
spec/weather-model_spec.rb
+8
-5
No files found.
spec/weather-model_spec.rb
View file @
da693bf7
...
@@ -23,7 +23,7 @@ RSpec.describe WeatherModel do
...
@@ -23,7 +23,7 @@ RSpec.describe WeatherModel do
end
end
it
'Forecast'
do
it
'Forecast'
do
Forecast
::
ShanghaiTen
.
create
({
mysql_obj
=
Forecast
::
ShanghaiTen
.
create
({
datetime:
'2017-05-16'
,
datetime:
'2017-05-16'
,
cityname:
'shanghai'
,
cityname:
'shanghai'
,
temp_high:
'100'
,
temp_high:
'100'
,
...
@@ -35,10 +35,13 @@ RSpec.describe WeatherModel do
...
@@ -35,10 +35,13 @@ RSpec.describe WeatherModel do
})
})
expect
(
Forecast
::
ShanghaiTen
.
count
).
to
eq
(
1
)
expect
(
Forecast
::
ShanghaiTen
.
count
).
to
eq
(
1
)
expect
(
Forecast
::
ShanghaiTen
::
Ohm
.
all
.
count
).
to
eq
(
1
)
expect
(
Forecast
::
ShanghaiTen
::
Ohm
.
all
.
count
).
to
eq
(
1
)
# p 'p Forecast::ShanghaiTen::Ohm.all.first.attributes'
# ttl 失败
expect
(
Forecast
::
ShanghaiTen
::
Ohm
.
all
.
first
.
temp_low
).
to
eq
(
mysql_obj
.
temp_low
.
to_s
)
p
Forecast
::
ShanghaiTen
::
Ohm
.
all
.
to_a
# 'ohm 对象 同步 mysql对象更新'
p
Forecast
::
ShanghaiTen
::
Ohm
.
all
.
to_a
.
map
(
&
:get_ttl
)
mysql_obj
.
update
(
temp_low:
99
)
expect
(
Forecast
::
ShanghaiTen
::
Ohm
.
all
.
first
.
temp_low
).
to
eq
(
'99'
),
'ohm 对象 同步 mysql对象更新'
# ttl 失败
# p Forecast::ShanghaiTen::Ohm.all.to_a.map(&:get_ttl)
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