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
ca845b7f
Commit
ca845b7f
authored
May 31, 2015
by
Olivier Halligon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command::Cache] "cache clean" spec + rubocop
parent
5ad0b2dd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
21 deletions
+57
-21
clean_spec.rb
spec/functional/command/cache/clean_spec.rb
+38
-0
list_spec.rb
spec/functional/command/cache/list_spec.rb
+2
-3
temporary_cache.rb
spec/spec_helper/temporary_cache.rb
+17
-18
No files found.
spec/functional/command/cache/clean_spec.rb
0 → 100644
View file @
ca845b7f
require
File
.
expand_path
(
'../../../../spec_helper'
,
__FILE__
)
module
Pod
describe
Command
::
Cache
::
Clean
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryCache
before
do
SpecHelper
::
TemporaryCache
.
set_up_test_cache
config
.
cache_root
=
SpecHelper
::
TemporaryCache
.
tmp_cache_path
end
it
'requires --all if no name given'
do
e
=
lambda
{
run_command
(
'cache'
,
'clean'
)
}.
should
.
raise
CLAide
::
Help
e
.
message
.
should
.
match
(
/specify a pod name or use the --all flag/
)
end
it
'asks the pod to clean when multiple matches'
do
e
=
lambda
{
run_command
(
'cache'
,
'clean'
,
'AFNetworking'
)
}.
should
.
raise
Pod
::
Informative
e
.
message
.
should
==
'[!] 0 is invalid [1-2]'
end
it
'clean all matching pod when given a name and --all'
do
run_command
(
'cache'
,
'clean'
,
'--all'
,
'AFNetworking'
)
Dir
.
glob
(
tmp_cache_path
+
'**/AFNetworking'
).
select
{
|
f
|
File
.
file?
(
f
)
}.
should
==
[]
end
it
'clean all pods when given --all'
do
run_command
(
'cache'
,
'clean'
,
'--all'
)
Dir
.
glob
(
tmp_cache_path
+
'**/*'
).
should
==
[]
end
it
'warns when no matching pod found in the cache'
do
output
=
run_command
(
'cache'
,
'clean'
,
'non-existing-pod'
)
output
.
should
.
match
(
/No cache for pod/
)
end
end
end
spec/functional/command/cache/list_spec.rb
View file @
ca845b7f
...
@@ -29,7 +29,7 @@ module Pod
...
@@ -29,7 +29,7 @@ module Pod
it
'shows the long form without --short'
do
it
'shows the long form without --short'
do
output
=
run_command
(
'cache'
,
'list'
,
'AFNetworking'
)
output
=
run_command
(
'cache'
,
'list'
,
'AFNetworking'
)
yaml
=
YAML
.
load
(
output
)
yaml
=
YAML
.
load
(
output
)
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
false
).
select
do
|
key
,
_
|
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
false
).
select
do
|
key
,
_
|
key
==
'AFNetworking'
key
==
'AFNetworking'
end
end
end
end
...
@@ -38,11 +38,10 @@ module Pod
...
@@ -38,11 +38,10 @@ module Pod
run_command
(
'cache'
,
'list'
,
'--short'
,
'bananalib'
)
run_command
(
'cache'
,
'list'
,
'--short'
,
'bananalib'
)
output
=
run_command
(
'cache'
,
'list'
,
'AFNetworking'
)
output
=
run_command
(
'cache'
,
'list'
,
'AFNetworking'
)
yaml
=
YAML
.
load
(
output
)
yaml
=
YAML
.
load
(
output
)
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
false
).
select
do
|
key
,
_
|
yaml
.
should
==
SpecHelper
::
TemporaryCache
.
test_cache_yaml
(
false
).
select
do
|
key
,
_
|
[
'AFNetworking'
,
'$CACHE_ROOT'
].
include?
(
key
)
[
'AFNetworking'
,
'$CACHE_ROOT'
].
include?
(
key
)
end
end
end
end
end
end
end
end
end
end
spec/spec_helper/temporary_cache.rb
View file @
ca845b7f
...
@@ -26,31 +26,30 @@ module SpecHelper
...
@@ -26,31 +26,30 @@ module SpecHelper
cache_root
=
"
#{
tmp_cache_path
}
/Pods"
cache_root
=
"
#{
tmp_cache_path
}
/Pods"
root_path
=
short
?
''
:
"
#{
cache_root
}
/"
root_path
=
short
?
''
:
"
#{
cache_root
}
/"
yaml
=
{
yaml
=
{
"AFNetworking"
=>
[
'AFNetworking'
=>
[
{
"Version"
=>
"2.5.4"
,
{
'Version'
=>
'2.5.4'
,
"Type"
=>
"External"
,
'Type'
=>
'External'
,
"Spec"
=>
"
#{
root_path
}
Specs/External/AFNetworking/d9ac25e7b83cea885663771c90998c47.podspec.json"
,
'Spec'
=>
"
#{
root_path
}
Specs/External/AFNetworking/d9ac25e7b83cea885663771c90998c47.podspec.json"
,
"Pod"
=>
"
#{
root_path
}
External/AFNetworking/e84d20f40f2049470632ce56ff0ce26f-05edc"
'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"
,
},
},
{
"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
[
'$CACHE_ROOT'
]
=
cache_root
if
short
yaml
yaml
end
end
module_function
:set_up_test_cache
,
:tmp_cache_path
,
:test_cache_yaml
module_function
:set_up_test_cache
,
:tmp_cache_path
,
:test_cache_yaml
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