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
c16445d8
Commit
c16445d8
authored
Apr 24, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Specs] Added specs for PUSH command and for the improvements to SPEC LINT subcommand
parent
35a650f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
189 additions
and
13 deletions
+189
-13
push_spec.rb
spec/functional/command/push_spec.rb
+74
-0
spec_spec.rb
spec/functional/command/spec_spec.rb
+115
-13
No files found.
spec/functional/command/push_spec.rb
0 → 100644
View file @
c16445d8
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Command
::
Push
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
Git
extend
SpecHelper
::
TemporaryDirectory
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'push'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'push'
,
'--allow-warnings'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'push'
,
'--wrong-option'
)
}.
should
.
raise
Pod
::
Command
::
Help
end
it
"complains if it can't find the repo"
do
repo1
=
add_repo
(
'repo1'
,
fixture
(
'spec-repos/master'
))
Dir
.
chdir
(
fixture
(
'banana-lib'
))
do
lambda
{
run_command
(
'push'
,
'repo2'
)
}.
should
.
raise
Pod
::
Informative
end
end
it
"complains if it can't find a spec"
do
repo1
=
add_repo
(
'repo1'
,
fixture
(
'spec-repos/master'
))
lambda
{
run_command
(
'push'
,
'repo1'
)
}.
should
.
raise
Pod
::
Informative
end
it
"it raises if the pod is not validated"
do
repo1
=
add_repo
(
'repo1'
,
fixture
(
'spec-repos/master'
))
git
(
'repo1'
,
'checkout master'
)
# checkout master, because the fixture is a submodule
repo2
=
add_repo
(
'repo2'
,
repo1
.
dir
)
git_config
(
'repo2'
,
'remote.origin.url'
).
should
==
(
tmp_repos_path
+
'repo1'
).
to_s
Dir
.
chdir
(
fixture
(
'banana-lib'
))
do
lambda
{
command
(
'push'
,
'repo2'
,
'--silent'
).
run
}.
should
.
raise
Pod
::
Informative
end
# (repo1.dir + 'BananaLib/1.0/BananaLib.podspec').read.should.include 'Added!'
end
before
do
# prepare the repos
@upstream
=
add_repo
(
'upstream'
,
fixture
(
'spec-repos/master'
))
git
(
'upstream'
,
'checkout -b master'
)
# checkout master, because the fixture is a submodule
@local_repo
=
add_repo
(
'local_repo'
,
@upstream
.
dir
)
git_config
(
'local_repo'
,
'remote.origin.url'
).
should
==
(
tmp_repos_path
+
'upstream'
).
to_s
git
(
'upstream'
,
'checkout -b no-master'
)
# checkout no-master, to allow push in a non-bare repository
# prepare the spec
spec_fix
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
spec_add
=
spec_fix
.
gsub
(
/https:\/\/github\.com\/johnezang\/JSONKit\.git/
,
fixture
(
'integration/JSONKit'
))
spec_add
.
gsub!
(
/'JSONKit'/
,
"'PushTest'"
)
File
.
open
(
temporary_directory
+
'JSONKit.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_fix
)
}
File
.
open
(
temporary_directory
+
'PushTest.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_add
)
}
end
it
"refuses to push if the repo is not clean"
do
File
.
open
(
@local_repo
.
dir
+
'README'
,
'w'
)
{
|
f
|
f
.
write
(
'Added!'
)
}
(
@local_repo
.
dir
+
'README'
).
read
.
should
.
include
'Added!'
cmd
=
command
(
'push'
,
'local_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
}
git
(
'upstream'
,
'checkout master'
)
# checkout master, because the fixture is a submodule
(
@upstream
.
dir
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
end
it
"sucessfully pushes a spec"
do
cmd
=
command
(
'push'
,
'local_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
cmd
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
cmd
.
output
.
should
.
include
(
'[Fix] JSONKit (1.4)'
)
git
(
'upstream'
,
'checkout master'
)
# checkout master, because the fixture is a submodule
(
@upstream
.
dir
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
end
end
spec/functional/command/spec_spec.rb
View file @
c16445d8
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
"Pod::Command::Spec"
do
describe
Pod
::
Command
::
Spec
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
Github
extend
SpecHelper
::
TemporaryDirectory
it
"runs with correct parameters"
do
lambda
{
run_command
(
'spec'
,
'create'
,
'Bananas'
)
}.
should
.
not
.
raise
expect_github_repo_request
expect_github_user_request
expect_github_tags_request
lambda
{
run_command
(
'spec'
,
'create'
,
'https://github.com/lukeredpath/libPusher.git'
)
}.
should
.
not
.
raise
end
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'spec'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'spec'
,
'create'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'spec'
,
'--create'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'spec'
,
'NAME'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'spec'
,
'createa'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'
spec'
,
'create
'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'
lint'
,
'agument1'
,
'2
'
)
}.
should
.
raise
Pod
::
Command
::
Help
end
end
describe
"Pod::Command::Spec create"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
Github
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
Git
it
"creates a new podspec stub file"
do
run_command
(
'spec'
,
'create'
,
'Bananas'
)
...
...
@@ -50,6 +50,22 @@ describe "Pod::Command::Spec" do
spec
.
source
.
should
==
{
:git
=>
'https://github.com/lukeredpath/libPusher.git'
,
:tag
=>
'v1.3'
}
end
it
"accepts the a name when creating a podspec form github"
do
expect_github_repo_request
expect_github_user_request
expect_github_tags_request
run_command
(
'spec'
,
'create'
,
'other_name'
,
'https://github.com/lukeredpath/libPusher.git'
)
path
=
temporary_directory
+
'other_name.podspec'
spec
=
Pod
::
Specification
.
from_file
(
path
)
spec
.
name
.
should
==
'other_name'
spec
.
license
.
should
==
{
:type
=>
"MIT"
,
:file
=>
"LICENSE"
}
spec
.
version
.
should
==
Pod
::
Version
.
new
(
'1.3'
)
spec
.
summary
.
should
==
'An Objective-C interface to Pusher (pusherapp.com)'
spec
.
homepage
.
should
==
'https://github.com/lukeredpath/libPusher'
spec
.
authors
.
should
==
{
"Luke Redpath"
=>
"luke@lukeredpath.co.uk"
}
spec
.
source
.
should
==
{
:git
=>
'https://github.com/lukeredpath/libPusher.git'
,
:tag
=>
'v1.3'
}
end
it
"correctly suggests the head commit if a suitable tag is not available on github"
do
expect_github_repo_request
expect_github_user_request
...
...
@@ -71,8 +87,94 @@ describe "Pod::Command::Spec" do
output
.
should
.
include
'MARKDOWN TEMPLATE'
output
.
should
.
include
'Please add semantic version tags'
end
end
describe
"Pod::Command::Spec lint"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
Git
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
end
after
do
config
.
repos_dir
=
tmp_repos_path
end
it
"lints a repo"
do
# the fixture master repo has warnings and does not validates
lambda
{
run_command
(
'spec'
,
'lint'
,
'master'
)
}.
should
.
raise
Pod
::
Informative
end
it
"lints a repo with --only-errors option and show the warnings"
do
output
=
run_command
(
'spec'
,
'lint'
,
'master'
,
'--only-errors'
)
output
.
should
.
include
"passed validation"
output
.
should
.
include
"WARN"
end
it
"complains if no repo name or url are provided and there a no specs in the current working directory"
do
Dir
.
chdir
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/'
)
do
lambda
{
command
(
'spec'
,
'lint'
).
run
}.
should
.
raise
Pod
::
Informative
end
end
it
"lints the current working directory"
do
Dir
.
chdir
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/'
)
do
output
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--only-errors'
).
run
output
.
should
.
include
"passed validation"
end
end
it
"lints a givent podspec"
do
spec_file
=
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
output
=
run_command
(
'spec'
,
'lint'
,
'--quick'
,
spec_file
)
output
.
should
.
include
"passed validation"
end
before
do
spec
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
spec
.
gsub!
(
/https:\/\/github\.com\/johnezang\/JSONKit\.git/
,
fixture
(
'integration/JSONKit'
))
spec
.
gsub!
(
/s\.source_files = 'JSONKit\.\*'/
,
"s.source_files = 'JSONKit.*'
\n
s.resources = 'WRONG_FOLDER'"
)
File
.
open
(
temporary_directory
+
'JSONKit.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec
)
}
end
it
"fails if there are warnings"
do
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
}
cmd
.
output
.
should
.
include
"- WARN | Missing license[:file] or [:text]"
end
it
"respects the --only-errors option"
do
cmd
=
command
(
'spec'
,
'lint'
,
'--quick'
,
'--only-errors'
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
not
.
raise
Pod
::
Informative
}
cmd
.
output
.
should
.
include
"- WARN | Missing license[:file] or [:text]"
cmd
.
output
.
should
.
include
"passed validation"
end
it
"respects the --quick option"
do
cmd
=
command
(
'spec'
,
'--quick'
,
'lint'
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
}
cmd
.
output
.
should
.
not
.
include
"JSONKit/JSONKit.m:1640:27: warning: equality comparison with extraneous parentheses"
end
it
"uses xcodebuild to generate warnings and checks for file patterns"
do
# those two checks are merged because pod install is computationally expensive
cmd
=
command
(
'spec'
,
'lint'
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
}
cmd
.
output
.
should
.
include
"JSONKit/JSONKit.m:1640:27: warning: equality comparison with extraneous parentheses"
cmd
.
output
.
should
.
include
"- ERROR | [resources = 'WRONG_FOLDER'] -> did not match any file"
end
before
do
spec
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
spec
.
gsub!
(
/s\.source_files = 'JSONKit\.\*'/
,
"s.source_files = 'JSONKit.*'
\n
if config.ios?
\n
end"
)
File
.
open
(
temporary_directory
+
'JSONKit.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec
)
}
end
it
"produces deprecation notices"
do
cmd
=
command
(
'spec'
,
'--quick'
,
'lint'
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
}
cmd
.
output
.
should
.
include
"- WARN | `config.ios?' and `config.osx' will be removed in version 0.7"
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