Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
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
gengmeiios
cocoapods
Commits
5ad0b2dd
Commit
5ad0b2dd
authored
May 31, 2015
by
Olivier Halligon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command::Cache] "cache list" spec
parent
b1228e70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
1 deletion
+77
-1
list_spec.rb
spec/functional/command/cache/list_spec.rb
+48
-0
temporary_cache.rb
spec/spec_helper/temporary_cache.rb
+29
-1
No files found.
spec/functional/command/cache/list_spec.rb
0 → 100644
View file @
5ad0b2dd
require
File
.
expand_path
(
'../../../../spec_helper'
,
__FILE__
)
require
'yaml'
module
Pod
describe
Command
::
Cache
::
List
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryCache
before
do
SpecHelper
::
TemporaryCache
.
set_up_test_cache
config
.
cache_root
=
SpecHelper
::
TemporaryCache
.
tmp_cache_path
end
describe
'lists the whole content of the cache as YAML'
do
it
'shows the long form without --short'
do
output
=
run_command
(
'cache'
,
'list'
)
yaml
=
YAML
.
load
(
output
)
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
false
)
end
it
'shows the short form with --short'
do
output
=
run_command
(
'cache'
,
'list'
,
'--short'
)
yaml
=
YAML
.
load
(
output
)
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
true
)
end
end
describe
'lists only the cache content for the requested pod as YAML'
do
it
'shows the long form without --short'
do
output
=
run_command
(
'cache'
,
'list'
,
'AFNetworking'
)
yaml
=
YAML
.
load
(
output
)
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
false
).
select
do
|
key
,
_
|
key
==
'AFNetworking'
end
end
it
'shows the short form with --short'
do
run_command
(
'cache'
,
'list'
,
'--short'
,
'bananalib'
)
output
=
run_command
(
'cache'
,
'list'
,
'AFNetworking'
)
yaml
=
YAML
.
load
(
output
)
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
false
).
select
do
|
key
,
_
|
[
'AFNetworking'
,
'$CACHE_ROOT'
].
include?
(
key
)
end
end
end
end
end
spec/spec_helper/temporary_cache.rb
View file @
5ad0b2dd
...
...
@@ -22,7 +22,35 @@ module SpecHelper
SpecHelper
.
temporary_directory
+
'cocoapods/cache/CocoaPods'
end
module_function
:set_up_test_cache
,
:tmp_cache_path
def
test_cache_yaml
(
short
=
false
)
cache_root
=
"
#{
tmp_cache_path
}
/Pods"
root_path
=
short
?
''
:
"
#{
cache_root
}
/"
yaml
=
{
"AFNetworking"
=>
[
{
"Version"
=>
"2.5.4"
,
"Type"
=>
"External"
,
"Spec"
=>
"
#{
root_path
}
Specs/External/AFNetworking/d9ac25e7b83cea885663771c90998c47.podspec.json"
,
"Pod"
=>
"
#{
root_path
}
External/AFNetworking/e84d20f40f2049470632ce56ff0ce26f-05edc"
},
{
"Version"
=>
"2.5.4"
,
"Type"
=>
"Release"
,
"Spec"
=>
"
#{
root_path
}
Specs/Release/AFNetworking/2.5.podspec.json"
,
"Pod"
=>
"
#{
root_path
}
Release/AFNetworking/2.5.4-05edc"
}
],
"CocoaLumberjack"
=>
[
{
"Version"
=>
"2.0.0"
,
"Type"
=>
"Release"
,
"Spec"
=>
"
#{
root_path
}
Specs/Release/CocoaLumberjack/2.0.podspec.json"
,
"Pod"
=>
"
#{
root_path
}
Release/CocoaLumberjack/2.0.0-a6f77"
}
]
}
yaml
[
'$CACHE_ROOT'
]
=
cache_root
if
short
yaml
end
module_function
:set_up_test_cache
,
:tmp_cache_path
,
:test_cache_yaml
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