Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
13298bb3
Commit
13298bb3
authored
May 17, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for #cast_value_from_cache
parent
a63ada5e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
spec/models/concerns/redis_cacheable_spec.rb
spec/models/concerns/redis_cacheable_spec.rb
+36
-0
No files found.
spec/models/concerns/redis_cacheable_spec.rb
View file @
13298bb3
...
@@ -83,4 +83,40 @@ describe RedisCacheable do
...
@@ -83,4 +83,40 @@ describe RedisCacheable do
expect
(
instance
.
name
).
to
eq
(
'new_value'
)
expect
(
instance
.
name
).
to
eq
(
'new_value'
)
end
end
end
end
describe
'#cast_value_from_cache'
do
let
(
:instance
)
{
Ci
::
Runner
.
new
}
subject
{
instance
.
__send__
(
:cast_value_from_cache
,
attribute
,
value
)
}
shared_context
'runner contacted_at context'
do
let
(
:attribute
)
{
:contacted_at
}
let
(
:value
)
{
'2018-05-07 13:53:08 UTC'
}
end
context
'on rails5'
do
include_context
'runner contacted_at context'
before
do
allow
(
Gitlab
).
to
receive
(
:rails5?
).
and_return
(
true
)
end
it
'converts cache string to appropriate type'
do
pending
'Migration to rails5'
expect
(
subject
).
to
be_an_instance_of
(
ActiveSupport
::
TimeWithZone
)
end
end
context
'not on rails5'
do
include_context
'runner contacted_at context'
before
do
allow
(
Gitlab
).
to
receive
(
:rails5?
).
and_return
(
false
)
end
it
'converts cache string to appropriate type'
do
expect
(
subject
).
to
be_an_instance_of
(
ActiveSupport
::
TimeWithZone
)
end
end
end
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