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
870eed7c
Commit
870eed7c
authored
Jan 15, 2014
by
Joshua Kalpin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1741 from carsonmcdonald/edittests
Add tests for the spec edit command
parents
cb539e2b
c34c84a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
spec_spec.rb
spec/functional/command/spec_spec.rb
+35
-0
spec_helper.rb
spec/spec_helper.rb
+18
-0
No files found.
spec/functional/command/spec_spec.rb
View file @
870eed7c
...
@@ -221,8 +221,43 @@ module Pod
...
@@ -221,8 +221,43 @@ module Pod
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
describe
Command
::
Spec
::
Edit
do
describe
Command
::
Spec
::
Edit
do
before
do
@path_saved
=
ENV
[
'PATH'
]
end
after
do
ENV
[
'PATH'
]
=
@path_saved
end
it_should_check_for_existence
(
"edit"
)
it_should_check_for_existence
(
"edit"
)
it_should_check_for_ambiguity
(
"edit"
)
it_should_check_for_ambiguity
(
"edit"
)
it
"would execute the editor specified in ENV with the given podspec"
do
ENV
[
'EDITOR'
]
=
'podspeceditor'
lambda
{
command
(
'spec'
,
'edit'
,
'AFNetworking'
).
run
}.
should
.
raise
SystemExit
UI
.
output
.
should
.
include
'/bin/sh -i -c podspeceditor "$@" --'
UI
.
output
.
should
.
include
'fixtures/spec-repos/master/AFNetworking'
end
it
"will raise if no editor is found"
do
ENV
[
'PATH'
]
=
''
ENV
[
'EDITOR'
]
=
nil
lambda
{
command
(
'spec'
,
'edit'
,
'AFNetworking'
).
run
}.
should
.
raise
Informative
end
it
"would execute an editor with the first podspec from all podspecs"
do
ENV
[
'EDITOR'
]
=
'podspeceditor'
UI
.
next_input
=
"1
\n
"
lambda
{
command
(
'spec'
,
'edit'
,
'--show-all'
,
'AFNetworking'
).
run
}.
should
.
raise
SystemExit
UI
.
output
.
should
.
include
'/bin/sh -i -c podspeceditor "$@" --'
UI
.
output
.
should
.
include
'fixtures/spec-repos/master/AFNetworking/1.2.0/AFNetworking.podspec'
end
it
"complains if it can't find a spec file for the given spec"
do
File
.
stubs
(
:exists?
).
returns
(
false
)
lambda
{
command
(
'spec'
,
'edit'
,
'AFNetworking'
).
run
}.
should
.
raise
Informative
File
.
unstub
(
:exists?
)
end
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
...
spec/spec_helper.rb
View file @
870eed7c
...
@@ -67,6 +67,24 @@ module Pod
...
@@ -67,6 +67,24 @@ module Pod
end
end
end
end
# README!
#
# Adds {Command::Spec::Edit#exec} to fake the {Kernel#exec} call that would
# normally be made during an edit.
#
module
Pod
class
Command
class
Spec
class
Edit
def
exec
(
cmd
,
*
args
)
UI
.
puts
"
#{
cmd
}
#{
args
.
join
(
' '
)
}
"
raise
SystemExit
end
end
end
end
end
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
ENV
[
'SKIP_SETUP'
]
=
'true'
ENV
[
'SKIP_SETUP'
]
=
'true'
...
...
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