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
8c920151
Commit
8c920151
authored
Jan 03, 2015
by
Kyle Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Specs] Stop using `sut`
parent
cdf94bda
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
44 deletions
+44
-44
spec_spec.rb
spec/functional/command/spec_spec.rb
+5
-5
config_spec.rb
spec/unit/config_spec.rb
+33
-33
private_pod_xcconfig_spec.rb
spec/unit/generator/xcconfig/private_pod_xcconfig_spec.rb
+6
-6
validator_spec.rb
spec/unit/validator_spec.rb
+0
-0
No files found.
spec/functional/command/spec_spec.rb
View file @
8c920151
...
@@ -356,14 +356,14 @@ module Pod
...
@@ -356,14 +356,14 @@ module Pod
before
do
before
do
# TODO Use class methods
# TODO Use class methods
@
sut
=
Command
::
Spec
.
new
(
CLAide
::
ARGV
.
new
([]))
@
command
=
Command
::
Spec
.
new
(
CLAide
::
ARGV
.
new
([]))
end
end
describe
'#get_path_of_spec'
do
describe
'#get_path_of_spec'
do
it
'returns the path of the specification with the given name'
do
it
'returns the path of the specification with the given name'
do
path
=
@
sut
.
send
(
:get_path_of_spec
,
'AFNetworking'
)
path
=
@
command
.
send
(
:get_path_of_spec
,
'AFNetworking'
)
path
.
should
==
fixture
(
'spec-repos'
)
+
'master/Specs/AFNetworking/2.4.1/AFNetworking.podspec.json'
path
.
should
==
fixture
(
'spec-repos'
)
+
'master/Specs/AFNetworking/2.4.1/AFNetworking.podspec.json'
end
end
...
@@ -373,16 +373,16 @@ module Pod
...
@@ -373,16 +373,16 @@ module Pod
it
'should return a valid index for the given array'
do
it
'should return a valid index for the given array'
do
UI
.
next_input
=
"1
\n
"
UI
.
next_input
=
"1
\n
"
index
=
@
sut
.
send
(
:choose_from_array
,
%w(item1 item2 item3)
,
'A message'
)
index
=
@
command
.
send
(
:choose_from_array
,
%w(item1 item2 item3)
,
'A message'
)
UI
.
output
.
should
.
include
"1: item1
\n
2: item2
\n
3: item3
\n
A message
\n
"
UI
.
output
.
should
.
include
"1: item1
\n
2: item2
\n
3: item3
\n
A message
\n
"
index
.
should
==
0
index
.
should
==
0
end
end
it
'should raise when the index is out of bounds'
do
it
'should raise when the index is out of bounds'
do
UI
.
next_input
=
"4
\n
"
UI
.
next_input
=
"4
\n
"
lambda
{
@
sut
.
send
(
:choose_from_array
,
%w(item1 item2 item3)
,
'A message'
)
}.
should
.
raise
Pod
::
Informative
lambda
{
@
command
.
send
(
:choose_from_array
,
%w(item1 item2 item3)
,
'A message'
)
}.
should
.
raise
Pod
::
Informative
UI
.
next_input
=
"0
\n
"
UI
.
next_input
=
"0
\n
"
lambda
{
@
sut
.
send
(
:choose_from_array
,
%w(item1 item2 item3)
,
'A message'
)
}.
should
.
raise
Pod
::
Informative
lambda
{
@
command
.
send
(
:choose_from_array
,
%w(item1 item2 item3)
,
'A message'
)
}.
should
.
raise
Pod
::
Informative
end
end
end
end
...
...
spec/unit/config_spec.rb
View file @
8c920151
...
@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
...
@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
module
Pod
module
Pod
describe
Config
do
describe
Config
do
before
do
before
do
@
sut
=
Config
.
new
(
false
)
@
config
=
Config
.
new
(
false
)
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -11,35 +11,35 @@ module Pod
...
@@ -11,35 +11,35 @@ module Pod
describe
'In general'
do
describe
'In general'
do
it
'returns the singleton config instance'
do
it
'returns the singleton config instance'
do
@
sut
.
should
.
be
.
instance_of
Config
@
config
.
should
.
be
.
instance_of
Config
end
end
it
'returns the path to the home dir'
do
it
'returns the path to the home dir'
do
@
sut
.
home_dir
.
should
==
Pathname
.
new
(
'~/.cocoapods'
).
expand_path
@
config
.
home_dir
.
should
==
Pathname
.
new
(
'~/.cocoapods'
).
expand_path
end
end
it
'returns the path to the spec-repos dir'
do
it
'returns the path to the spec-repos dir'
do
@
sut
.
repos_dir
.
should
==
Pathname
.
new
(
'~/.cocoapods/repos'
).
expand_path
@
config
.
repos_dir
.
should
==
Pathname
.
new
(
'~/.cocoapods/repos'
).
expand_path
end
end
it
'returns the path to the templates dir'
do
it
'returns the path to the templates dir'
do
@
sut
.
templates_dir
.
should
==
Pathname
.
new
(
'~/.cocoapods/templates'
).
expand_path
@
config
.
templates_dir
.
should
==
Pathname
.
new
(
'~/.cocoapods/templates'
).
expand_path
end
end
it
'returns the path of the default podfiles'
do
it
'returns the path of the default podfiles'
do
@
sut
.
default_podfile_path
.
should
==
Pathname
.
new
(
'~/.cocoapods/templates/Podfile.default'
).
expand_path
@
config
.
default_podfile_path
.
should
==
Pathname
.
new
(
'~/.cocoapods/templates/Podfile.default'
).
expand_path
@
sut
.
default_test_podfile_path
.
should
==
Pathname
.
new
(
'~/.cocoapods/templates/Podfile.test'
).
expand_path
@
config
.
default_test_podfile_path
.
should
==
Pathname
.
new
(
'~/.cocoapods/templates/Podfile.test'
).
expand_path
end
end
it
'allows to specify the home dir with an environment variable'
do
it
'allows to specify the home dir with an environment variable'
do
ENV
[
'CP_HOME_DIR'
]
=
'~/custom_home_dir'
ENV
[
'CP_HOME_DIR'
]
=
'~/custom_home_dir'
@
sut
.
home_dir
.
should
==
Pathname
.
new
(
'~/custom_home_dir'
).
expand_path
@
config
.
home_dir
.
should
==
Pathname
.
new
(
'~/custom_home_dir'
).
expand_path
ENV
.
delete
(
'CP_HOME_DIR'
)
ENV
.
delete
(
'CP_HOME_DIR'
)
end
end
it
'allows to specify the repos dir with an environment variable'
do
it
'allows to specify the repos dir with an environment variable'
do
ENV
[
'CP_REPOS_DIR'
]
=
'~/custom_repos_dir'
ENV
[
'CP_REPOS_DIR'
]
=
'~/custom_repos_dir'
@
sut
.
repos_dir
.
should
==
Pathname
.
new
(
'~/custom_repos_dir'
).
expand_path
@
config
.
repos_dir
.
should
==
Pathname
.
new
(
'~/custom_repos_dir'
).
expand_path
ENV
.
delete
(
'CP_REPOS_DIR'
)
ENV
.
delete
(
'CP_REPOS_DIR'
)
end
end
end
end
...
@@ -51,7 +51,7 @@ module Pod
...
@@ -51,7 +51,7 @@ module Pod
it
'returns the working directory as the installation root if a Podfile can be found'
do
it
'returns the working directory as the installation root if a Podfile can be found'
do
Dir
.
chdir
(
temporary_directory
)
do
Dir
.
chdir
(
temporary_directory
)
do
File
.
open
(
'Podfile'
,
'w'
)
{}
File
.
open
(
'Podfile'
,
'w'
)
{}
@
sut
.
installation_root
.
should
==
temporary_directory
@
config
.
installation_root
.
should
==
temporary_directory
end
end
end
end
...
@@ -61,54 +61,54 @@ module Pod
...
@@ -61,54 +61,54 @@ module Pod
sub_dir
=
temporary_directory
+
'sub_dir'
sub_dir
=
temporary_directory
+
'sub_dir'
sub_dir
.
mkpath
sub_dir
.
mkpath
Dir
.
chdir
(
sub_dir
)
do
Dir
.
chdir
(
sub_dir
)
do
@
sut
.
installation_root
.
should
==
temporary_directory
@
config
.
installation_root
.
should
==
temporary_directory
end
end
end
end
end
end
it
'it returns the working directory as the installation root if no Podfile can be found'
do
it
'it returns the working directory as the installation root if no Podfile can be found'
do
Dir
.
chdir
(
temporary_directory
)
do
Dir
.
chdir
(
temporary_directory
)
do
@
sut
.
installation_root
.
should
==
temporary_directory
@
config
.
installation_root
.
should
==
temporary_directory
end
end
end
end
before
do
before
do
@
sut
.
installation_root
=
temporary_directory
@
config
.
installation_root
=
temporary_directory
end
end
it
'returns the path to the project root'
do
it
'returns the path to the project root'
do
@
sut
.
installation_root
.
should
==
temporary_directory
@
config
.
installation_root
.
should
==
temporary_directory
end
end
it
'returns the path to the project Podfile if it exists'
do
it
'returns the path to the project Podfile if it exists'
do
(
temporary_directory
+
'Podfile'
).
open
(
'w'
)
{
|
f
|
f
<<
'# Yo'
}
(
temporary_directory
+
'Podfile'
).
open
(
'w'
)
{
|
f
|
f
<<
'# Yo'
}
@
sut
.
podfile_path
.
should
==
temporary_directory
+
'Podfile'
@
config
.
podfile_path
.
should
==
temporary_directory
+
'Podfile'
end
end
it
'can detect yaml Podfiles'
do
it
'can detect yaml Podfiles'
do
(
temporary_directory
+
'CocoaPods.podfile.yaml'
).
open
(
'w'
)
{
|
f
|
f
<<
'# Yo'
}
(
temporary_directory
+
'CocoaPods.podfile.yaml'
).
open
(
'w'
)
{
|
f
|
f
<<
'# Yo'
}
@
sut
.
podfile_path
.
should
==
temporary_directory
+
'CocoaPods.podfile.yaml'
@
config
.
podfile_path
.
should
==
temporary_directory
+
'CocoaPods.podfile.yaml'
end
end
it
'can detect files named `CocoaPods.podfile`'
do
it
'can detect files named `CocoaPods.podfile`'
do
(
temporary_directory
+
'CocoaPods.podfile'
).
open
(
'w'
)
{
|
f
|
f
<<
'# Yo'
}
(
temporary_directory
+
'CocoaPods.podfile'
).
open
(
'w'
)
{
|
f
|
f
<<
'# Yo'
}
@
sut
.
podfile_path
.
should
==
temporary_directory
+
'CocoaPods.podfile'
@
config
.
podfile_path
.
should
==
temporary_directory
+
'CocoaPods.podfile'
end
end
it
'returns the path to the Pods directory that holds the dependencies'
do
it
'returns the path to the Pods directory that holds the dependencies'
do
@
sut
.
sandbox_root
.
should
==
temporary_directory
+
'Pods'
@
config
.
sandbox_root
.
should
==
temporary_directory
+
'Pods'
end
end
it
'returns the Podfile path'
do
it
'returns the Podfile path'
do
Dir
.
chdir
(
temporary_directory
)
do
Dir
.
chdir
(
temporary_directory
)
do
File
.
open
(
'Podfile'
,
'w'
)
{}
File
.
open
(
'Podfile'
,
'w'
)
{}
@
sut
.
podfile_path
.
should
==
temporary_directory
+
'Podfile'
@
config
.
podfile_path
.
should
==
temporary_directory
+
'Podfile'
end
end
end
end
it
'returns nils if the Podfile if no paths exists'
do
it
'returns nils if the Podfile if no paths exists'
do
Dir
.
chdir
(
temporary_directory
)
do
Dir
.
chdir
(
temporary_directory
)
do
@
sut
.
podfile_path
.
should
.
nil?
@
config
.
podfile_path
.
should
.
nil?
end
end
end
end
...
@@ -116,12 +116,12 @@ module Pod
...
@@ -116,12 +116,12 @@ module Pod
Dir
.
chdir
(
temporary_directory
)
do
Dir
.
chdir
(
temporary_directory
)
do
File
.
open
(
'Podfile'
,
'w'
)
{}
File
.
open
(
'Podfile'
,
'w'
)
{}
File
.
open
(
'Podfile.lock'
,
'w'
)
{}
File
.
open
(
'Podfile.lock'
,
'w'
)
{}
@
sut
.
lockfile_path
.
should
==
temporary_directory
+
'Podfile.lock'
@
config
.
lockfile_path
.
should
==
temporary_directory
+
'Podfile.lock'
end
end
end
end
it
'returns the search index file'
do
it
'returns the search index file'
do
@
sut
.
search_index_file
.
to_s
.
should
.
end_with?
(
'search_index.yaml'
)
@
config
.
search_index_file
.
to_s
.
should
.
end_with?
(
'search_index.yaml'
)
end
end
end
end
...
@@ -131,19 +131,19 @@ module Pod
...
@@ -131,19 +131,19 @@ module Pod
describe
'Default settings'
do
describe
'Default settings'
do
it
'prints out normal information'
do
it
'prints out normal information'
do
@
sut
.
should
.
not
.
be
.
silent
@
config
.
should
.
not
.
be
.
silent
end
end
it
'does not print verbose information'
do
it
'does not print verbose information'
do
@
sut
.
should
.
not
.
be
.
verbose
@
config
.
should
.
not
.
be
.
verbose
end
end
it
'cleans SCM dirs in dependency checkouts'
do
it
'cleans SCM dirs in dependency checkouts'
do
@
sut
.
should
.
clean
@
config
.
should
.
clean
end
end
it
'returns the cache root'
do
it
'returns the cache root'
do
@
sut
.
cache_root
.
should
==
Pathname
.
new
(
File
.
join
(
ENV
[
'HOME'
],
'Library/Caches/CocoaPods'
))
@
config
.
cache_root
.
should
==
Pathname
.
new
(
File
.
join
(
ENV
[
'HOME'
],
'Library/Caches/CocoaPods'
))
end
end
end
end
...
@@ -152,13 +152,13 @@ module Pod
...
@@ -152,13 +152,13 @@ module Pod
describe
'Private helpers'
do
describe
'Private helpers'
do
it
'returns the path of the user settings file'
do
it
'returns the path of the user settings file'
do
@
sut
.
send
(
:user_settings_file
).
should
==
Pathname
.
new
(
'~/.cocoapods/config.yaml'
).
expand_path
@
config
.
send
(
:user_settings_file
).
should
==
Pathname
.
new
(
'~/.cocoapods/config.yaml'
).
expand_path
end
end
it
'can be configured with a hash'
do
it
'can be configured with a hash'
do
hash
=
{
:verbose
=>
true
}
hash
=
{
:verbose
=>
true
}
@
sut
.
send
(
:configure_with
,
hash
)
@
config
.
send
(
:configure_with
,
hash
)
@
sut
.
should
.
be
.
verbose
@
config
.
should
.
be
.
verbose
end
end
#----------------------------------------#
#----------------------------------------#
...
@@ -168,26 +168,26 @@ module Pod
...
@@ -168,26 +168,26 @@ module Pod
it
'detects the CocoaPods.podfile.yaml file'
do
it
'detects the CocoaPods.podfile.yaml file'
do
expected
=
temporary_directory
+
'CocoaPods.podfile.yaml'
expected
=
temporary_directory
+
'CocoaPods.podfile.yaml'
File
.
open
(
expected
,
'w'
)
{}
File
.
open
(
expected
,
'w'
)
{}
path
=
@
sut
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
=
@
config
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
.
should
==
expected
path
.
should
==
expected
end
end
it
'detects the CocoaPods.podfile file'
do
it
'detects the CocoaPods.podfile file'
do
expected
=
temporary_directory
+
'CocoaPods.podfile'
expected
=
temporary_directory
+
'CocoaPods.podfile'
File
.
open
(
expected
,
'w'
)
{}
File
.
open
(
expected
,
'w'
)
{}
path
=
@
sut
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
=
@
config
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
.
should
==
expected
path
.
should
==
expected
end
end
it
'detects the Podfile file'
do
it
'detects the Podfile file'
do
expected
=
temporary_directory
+
'Podfile'
expected
=
temporary_directory
+
'Podfile'
File
.
open
(
expected
,
'w'
)
{}
File
.
open
(
expected
,
'w'
)
{}
path
=
@
sut
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
=
@
config
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
.
should
==
expected
path
.
should
==
expected
end
end
it
'returns nils if the Podfile is not available'
do
it
'returns nils if the Podfile is not available'
do
path
=
@
sut
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
=
@
config
.
send
(
:podfile_path_in_dir
,
temporary_directory
)
path
.
should
.
nil?
path
.
should
.
nil?
end
end
...
...
spec/unit/generator/xcconfig/private_pod_xcconfig_spec.rb
View file @
8c920151
...
@@ -77,7 +77,7 @@ module Pod
...
@@ -77,7 +77,7 @@ module Pod
describe
'Private Helpers'
do
describe
'Private Helpers'
do
before
do
before
do
@
sut
=
PrivatePodXCConfig
.
new
(
stub
,
stub
)
@
config
=
PrivatePodXCConfig
.
new
(
stub
,
stub
)
end
end
#----------------------------------------#
#----------------------------------------#
...
@@ -87,21 +87,21 @@ module Pod
...
@@ -87,21 +87,21 @@ module Pod
it
'appends to the values of the keys of the destination the value of the keys of the source'
do
it
'appends to the values of the keys of the destination the value of the keys of the source'
do
source_config
=
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/MyPod'
}
source_config
=
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/MyPod'
}
destination_config
=
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders'
}
destination_config
=
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders'
}
result
=
@
sut
.
send
(
:add_xcconfig_namespaced_keys
,
source_config
,
destination_config
,
'PREFIX_'
)
result
=
@
config
.
send
(
:add_xcconfig_namespaced_keys
,
source_config
,
destination_config
,
'PREFIX_'
)
result
.
should
==
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders ${PREFIX_HEADER_SEARCH_PATHS}'
}
result
.
should
==
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders ${PREFIX_HEADER_SEARCH_PATHS}'
}
end
end
it
'uses the key of the destination xcconfig if not present in the source'
do
it
'uses the key of the destination xcconfig if not present in the source'
do
source_config
=
{}
source_config
=
{}
destination_config
=
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders'
}
destination_config
=
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders'
}
result
=
@
sut
.
send
(
:add_xcconfig_namespaced_keys
,
source_config
,
destination_config
,
'PREFIX_'
)
result
=
@
config
.
send
(
:add_xcconfig_namespaced_keys
,
source_config
,
destination_config
,
'PREFIX_'
)
result
.
should
==
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders'
}
result
.
should
==
{
'HEADER_SEARCH_PATHS'
=>
'${PODS_ROOT}/BuildHeaders'
}
end
end
it
'preserves any value of the source not present in the destination'
do
it
'preserves any value of the source not present in the destination'
do
source_config
=
{
'EXCLUDED_SOURCE_FILE_NAMES'
=>
'ZBarReaderViewImpl_Simulator.m'
}
source_config
=
{
'EXCLUDED_SOURCE_FILE_NAMES'
=>
'ZBarReaderViewImpl_Simulator.m'
}
destination_config
=
{}
destination_config
=
{}
result
=
@
sut
.
send
(
:add_xcconfig_namespaced_keys
,
source_config
,
destination_config
,
'PREFIX_'
)
result
=
@
config
.
send
(
:add_xcconfig_namespaced_keys
,
source_config
,
destination_config
,
'PREFIX_'
)
result
.
should
==
{
'EXCLUDED_SOURCE_FILE_NAMES'
=>
'${PREFIX_EXCLUDED_SOURCE_FILE_NAMES}'
}
result
.
should
==
{
'EXCLUDED_SOURCE_FILE_NAMES'
=>
'${PREFIX_EXCLUDED_SOURCE_FILE_NAMES}'
}
end
end
...
@@ -112,12 +112,12 @@ module Pod
...
@@ -112,12 +112,12 @@ module Pod
describe
'#conditional_less_key'
do
describe
'#conditional_less_key'
do
it
'returns the key without the xcconfig conditional syntax if present'
do
it
'returns the key without the xcconfig conditional syntax if present'
do
result
=
@
sut
.
send
(
:conditional_less_key
,
'EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]'
)
result
=
@
config
.
send
(
:conditional_less_key
,
'EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*][arch=*]'
)
result
.
should
==
'EXCLUDED_SOURCE_FILE_NAMES'
result
.
should
==
'EXCLUDED_SOURCE_FILE_NAMES'
end
end
it
'returns the key as it is if no conditional syntax is present'
do
it
'returns the key as it is if no conditional syntax is present'
do
result
=
@
sut
.
send
(
:conditional_less_key
,
'EXCLUDED_SOURCE_FILE_NAMES'
)
result
=
@
config
.
send
(
:conditional_less_key
,
'EXCLUDED_SOURCE_FILE_NAMES'
)
result
.
should
==
'EXCLUDED_SOURCE_FILE_NAMES'
result
.
should
==
'EXCLUDED_SOURCE_FILE_NAMES'
end
end
...
...
spec/unit/validator_spec.rb
View file @
8c920151
This diff is collapsed.
Click to expand it.
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