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
d2c016be
Commit
d2c016be
authored
Mar 31, 2014
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Specs] Speed-up Command::Lib
parent
c14c319a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
46 deletions
+56
-46
lib_spec.rb
spec/functional/command/lib_spec.rb
+56
-46
No files found.
spec/functional/command/lib_spec.rb
View file @
d2c016be
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
describe
Command
::
Lib
::
Create
do
before
do
@sut
=
Command
::
Lib
::
Create
end
it
"complains if wrong parameters"
do
lambda
{
run_command
(
'lib'
,
'create'
)
}.
should
.
raise
CLAide
::
Help
end
...
...
@@ -9,12 +15,50 @@ module Pod
it
"complains if pod name contains spaces"
do
lambda
{
run_command
(
'lib'
,
'create'
,
'Pod Name With Spaces'
)
}.
should
.
raise
CLAide
::
Help
end
it
"should create a new dir for the newly created pod"
do
@sut
.
any_instance
.
stubs
(
:configure_template
)
url
=
@sut
::
TEMPLATE_REPO
@sut
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
url
}
' TestPod"
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
)
end
it
"configures the template after cloning it passing the name of the Pod as the argument"
do
@sut
.
any_instance
.
stubs
(
:clone_template
)
dir
=
SpecHelper
.
temporary_directory
+
'TestPod'
dir
.
mkpath
@sut
.
any_instance
.
expects
(
:ruby!
).
with
(
"_CONFIGURE.rb TestPod"
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
)
end
it
"should show link to new pod guide after creation"
do
@sut
.
any_instance
.
stubs
(
:clone_template
)
@sut
.
any_instance
.
stubs
(
:configure_template
)
output
=
run_command
(
'lib'
,
'create'
,
'TestPod'
)
output
.
should
.
include?
'http://guides.cocoapods.org/making/making-a-cocoapod'
end
before
do
@sut
.
any_instance
.
stubs
(
:configure_template
)
end
it
"should use the given template URL"
do
template_url
=
'https://github.com/custom/template.git'
@sut
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
sut
=
run_command
(
'lib'
,
'create'
,
'TestPod'
,
template_url
)
end
it
"should use the default URL if no template URL is given"
do
template_url
=
'https://github.com/CocoaPods/pod-template.git'
@sut
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
)
end
end
describe
Command
::
Lib
::
Lint
do
it
"lints the current working directory"
do
Dir
.
chdir
(
fixture
(
'integration/Reachability'
))
do
cmd
=
command
(
'lib'
,
'lint'
,
'--only-errors'
)
cmd
=
command
(
'lib'
,
'lint'
,
'--only-errors'
,
'--quick'
)
cmd
.
run
UI
.
output
.
should
.
include
"passed validation"
end
...
...
@@ -35,14 +79,12 @@ module Pod
f
<<
"spec.name = 'Broken'"
f
<<
'end'
}
tmp_validator
=
Validator
.
new
(
'Broken.podspec'
)
lint_path
=
tmp_validator
.
validation_dir
lambda
{
run_command
(
'lib'
,
'lint'
,
'Broken.podspec'
)
}.
should
.
raise
Pod
::
Informative
Validator
.
any_instance
.
expects
(
:no_clean
=
).
with
(
false
)
Validator
.
any_instance
.
stubs
(
:perform_extensive_analysis
)
should
.
raise
Pod
::
Informative
do
run_command
(
'lib'
,
'lint'
,
'Broken.podspec'
)
end
UI
.
output
.
should
.
include
"Missing required attribute"
lint_path
.
exist?
.
should
==
false
end
end
...
...
@@ -53,46 +95,14 @@ module Pod
f
<<
"spec.name = 'Broken'"
f
<<
'end'
}
lambda
{
run_command
(
'lib'
,
'lint'
,
'Broken.podspec'
,
'--no-clean'
)
}.
should
.
raise
Pod
::
Informative
UI
.
output
.
should
.
include
"Pods project available at"
Validator
.
any_instance
.
expects
(
:no_clean
=
).
with
(
true
)
Validator
.
any_instance
.
stubs
(
:perform_extensive_analysis
)
should
.
raise
Pod
::
Informative
do
run_command
(
'lib'
,
'lint'
,
'Broken.podspec'
,
'--no-clean'
)
end
UI
.
output
.
should
.
include
"Missing required attribute"
lint_dir
=
UI
.
output
[
/.*Pods project available at `(.*)` for inspection./
,
1
]
Pathname
.
new
(
lint_dir
).
exist?
.
should
==
true
UI
.
output
.
should
.
include
"Pods project available at"
end
end
end
describe
Command
::
Lib
do
it
"should create a new dir for the newly created pod"
do
run_command
(
'lib'
,
'create'
,
'TestPod'
)
Dir
.
chdir
(
temporary_directory
)
do
Pathname
.
new
(
temporary_directory
+
'TestPod'
).
exist?
.
should
==
true
end
end
it
"should show link to new pod guide after creation"
do
output
=
run_command
(
'lib'
,
'create'
,
'TestPod'
)
output
.
should
.
include?
'http://guides.cocoapods.org/making/making-a-cocoapod'
end
before
do
Command
::
Lib
::
Create
.
any_instance
.
stubs
(
:configure_template
)
Command
::
Lib
::
Create
.
any_instance
.
stubs
(
:git!
)
end
it
"should use the given template URL"
do
template_url
=
'https://github.com/custom/template.git'
Command
::
Lib
::
Create
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
sut
=
run_command
(
'lib'
,
'create'
,
'TestPod'
,
template_url
)
end
it
"should use the default URL if no template URL is given"
do
template_url
=
'https://github.com/CocoaPods/pod-template.git'
Command
::
Lib
::
Create
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
)
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