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
8d91ea79
Commit
8d91ea79
authored
Sep 06, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Project] Minor clean up
parent
3ed1918d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
54 deletions
+54
-54
project_spec.rb
spec/unit/project_spec.rb
+54
-54
No files found.
spec/unit/project_spec.rb
View file @
8d91ea79
...
@@ -4,7 +4,7 @@ module Pod
...
@@ -4,7 +4,7 @@ module Pod
describe
Project
do
describe
Project
do
before
do
before
do
@
projec
t
=
Project
.
new
(
config
.
sandbox
.
project_path
)
@
su
t
=
Project
.
new
(
config
.
sandbox
.
project_path
)
end
end
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
...
@@ -12,30 +12,30 @@ module Pod
...
@@ -12,30 +12,30 @@ module Pod
describe
"In general"
do
describe
"In general"
do
it
"returns the support files group"
do
it
"returns the support files group"
do
@
projec
t
.
support_files_group
.
name
.
should
==
'Targets Support Files'
@
su
t
.
support_files_group
.
name
.
should
==
'Targets Support Files'
end
end
it
"returns the pods group"
do
it
"returns the pods group"
do
@
projec
t
.
pods
.
name
.
should
==
'Pods'
@
su
t
.
pods
.
name
.
should
==
'Pods'
end
end
it
"returns development Pods group"
do
it
"returns development Pods group"
do
@
projec
t
.
development_pods
.
name
.
should
==
'Development Pods'
@
su
t
.
development_pods
.
name
.
should
==
'Development Pods'
end
end
describe
"#prepare_for_serialization"
do
describe
"#prepare_for_serialization"
do
it
"deletes the Pod and the Development Pods groups if empty"
do
it
"deletes the Pod and the Development Pods groups if empty"
do
@
projec
t
.
prepare_for_serialization
@
su
t
.
prepare_for_serialization
@
projec
t
[
Project
::
ROOT_GROUPS
[
:pods
]].
should
.
be
.
nil
@
su
t
[
Project
::
ROOT_GROUPS
[
:pods
]].
should
.
be
.
nil
@
projec
t
[
Project
::
ROOT_GROUPS
[
:development_pods
]].
should
.
be
.
nil
@
su
t
[
Project
::
ROOT_GROUPS
[
:development_pods
]].
should
.
be
.
nil
end
end
it
"sorts the groups recursively"
do
it
"sorts the groups recursively"
do
@
projec
t
.
pods
.
new_group
(
'group_2'
)
@
su
t
.
pods
.
new_group
(
'group_2'
)
@
projec
t
.
pods
.
new_group
(
'group_1'
)
@
su
t
.
pods
.
new_group
(
'group_1'
)
@
projec
t
.
prepare_for_serialization
@
su
t
.
prepare_for_serialization
@
projec
t
.
pods
.
children
.
map
(
&
:name
).
should
==
[
"group_1"
,
"group_2"
]
@
su
t
.
pods
.
children
.
map
(
&
:name
).
should
==
[
"group_1"
,
"group_2"
]
end
end
end
end
end
end
...
@@ -51,21 +51,21 @@ module Pod
...
@@ -51,21 +51,21 @@ module Pod
end
end
it
"adds the group for a Pod"
do
it
"adds the group for a Pod"
do
group
=
@
projec
t
.
add_pod_group
(
'BananaLib'
,
@path
)
group
=
@
su
t
.
add_pod_group
(
'BananaLib'
,
@path
)
group
.
parent
.
should
==
@
projec
t
.
pods
group
.
parent
.
should
==
@
su
t
.
pods
group
.
name
.
should
==
'BananaLib'
group
.
name
.
should
==
'BananaLib'
end
end
it
"adds the group for a development Pod"
do
it
"adds the group for a development Pod"
do
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
group
=
@
projec
t
.
add_pod_group
(
'BananaLib'
,
@path
,
true
)
group
=
@
su
t
.
add_pod_group
(
'BananaLib'
,
@path
,
true
)
group
.
parent
.
should
==
@
projec
t
.
development_pods
group
.
parent
.
should
==
@
su
t
.
development_pods
group
.
name
.
should
==
'BananaLib'
group
.
name
.
should
==
'BananaLib'
end
end
it
"configures the path of a new Pod group"
do
it
"configures the path of a new Pod group"
do
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
group
=
@
projec
t
.
add_pod_group
(
'BananaLib'
,
@path
)
group
=
@
su
t
.
add_pod_group
(
'BananaLib'
,
@path
)
group
.
source_tree
.
should
==
'<group>'
group
.
source_tree
.
should
==
'<group>'
group
.
path
.
should
==
'BananaLib'
group
.
path
.
should
==
'BananaLib'
Pathname
.
new
(
group
.
path
).
should
.
be
.
relative
Pathname
.
new
(
group
.
path
).
should
.
be
.
relative
...
@@ -73,14 +73,14 @@ module Pod
...
@@ -73,14 +73,14 @@ module Pod
it
"configures the path of a new Pod group as absolute if requested"
do
it
"configures the path of a new Pod group as absolute if requested"
do
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
group
=
@
projec
t
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
group
=
@
su
t
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
group
.
source_tree
.
should
==
'<absolute>'
group
.
source_tree
.
should
==
'<absolute>'
group
.
path
.
should
==
@path
.
to_s
group
.
path
.
should
==
@path
.
to_s
Pathname
.
new
(
group
.
path
).
should
.
be
.
absolute
Pathname
.
new
(
group
.
path
).
should
.
be
.
absolute
end
end
it
"creates a support file group relative to the project"
do
it
"creates a support file group relative to the project"
do
group
=
@
projec
t
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
group
=
@
su
t
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
group
[
'Support Files'
].
source_tree
.
should
==
'SOURCE_ROOT'
group
[
'Support Files'
].
source_tree
.
should
==
'SOURCE_ROOT'
group
[
'Support Files'
].
path
.
should
.
be
.
nil
group
[
'Support Files'
].
path
.
should
.
be
.
nil
end
end
...
@@ -91,17 +91,17 @@ module Pod
...
@@ -91,17 +91,17 @@ module Pod
describe
"#pod_groups"
do
describe
"#pod_groups"
do
before
do
before
do
@
projec
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@
su
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@
projec
t
.
add_pod_group
(
'OrangeLib'
,
config
.
sandbox
.
pod_dir
(
'OrangeLib'
),
true
)
@
su
t
.
add_pod_group
(
'OrangeLib'
,
config
.
sandbox
.
pod_dir
(
'OrangeLib'
),
true
)
end
end
it
"returns the pod groups"
do
it
"returns the pod groups"
do
@
projec
t
.
pod_groups
.
map
(
&
:name
).
sort
.
should
==
[
"BananaLib"
,
"OrangeLib"
]
@
su
t
.
pod_groups
.
map
(
&
:name
).
sort
.
should
==
[
"BananaLib"
,
"OrangeLib"
]
end
end
it
"doesn't alters the original groups"
do
it
"doesn't alters the original groups"
do
@
projec
t
.
pods
.
children
.
map
(
&
:name
).
sort
.
should
==
[
"BananaLib"
]
@
su
t
.
pods
.
children
.
map
(
&
:name
).
sort
.
should
==
[
"BananaLib"
]
@
projec
t
.
development_pods
.
children
.
map
(
&
:name
).
sort
.
should
==
[
"OrangeLib"
]
@
su
t
.
development_pods
.
children
.
map
(
&
:name
).
sort
.
should
==
[
"OrangeLib"
]
end
end
end
end
...
@@ -109,8 +109,8 @@ module Pod
...
@@ -109,8 +109,8 @@ module Pod
#----------------------------------------#
#----------------------------------------#
it
"returns the group of a Pod with a given name"
do
it
"returns the group of a Pod with a given name"
do
@
projec
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@
su
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@
projec
t
.
pod_group
(
'BananaLib'
).
name
.
should
==
'BananaLib'
@
su
t
.
pod_group
(
'BananaLib'
).
name
.
should
==
'BananaLib'
end
end
#----------------------------------------#
#----------------------------------------#
...
@@ -118,28 +118,28 @@ module Pod
...
@@ -118,28 +118,28 @@ module Pod
describe
"#group_for_spec"
do
describe
"#group_for_spec"
do
before
do
before
do
@
projec
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@
su
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
end
end
it
"returns the group for the spec with the given name"
do
it
"returns the group for the spec with the given name"
do
group
=
@
projec
t
.
group_for_spec
(
'BananaLib/Tree'
)
group
=
@
su
t
.
group_for_spec
(
'BananaLib/Tree'
)
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree'
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree'
end
end
it
"returns the requested subgroup"
do
it
"returns the requested subgroup"
do
group
=
@
projec
t
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group
=
@
su
t
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree/Source Files'
group
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Subspecs/Tree/Source Files'
end
end
it
"raises if unable to recognize the subgroup key"
do
it
"raises if unable to recognize the subgroup key"
do
should
.
raise
ArgumentError
do
should
.
raise
ArgumentError
do
@
projec
t
.
group_for_spec
(
'BananaLib/Tree'
,
:unknown
)
@
su
t
.
group_for_spec
(
'BananaLib/Tree'
,
:unknown
)
end
.
message
.
should
.
match
/Unrecognized subgroup/
end
.
message
.
should
.
match
/Unrecognized subgroup/
end
end
it
"doesn't duplicate the groups"
do
it
"doesn't duplicate the groups"
do
group_1
=
@
projec
t
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group_1
=
@
su
t
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group_2
=
@
projec
t
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group_2
=
@
su
t
.
group_for_spec
(
'BananaLib/Tree'
,
:source_files
)
group_1
.
uuid
.
should
==
group_2
.
uuid
group_1
.
uuid
.
should
==
group_2
.
uuid
end
end
end
end
...
@@ -152,26 +152,26 @@ module Pod
...
@@ -152,26 +152,26 @@ module Pod
describe
"#reference_for_path"
do
describe
"#reference_for_path"
do
before
do
before
do
@
projec
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@
su
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"file.m"
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"file.m"
@group
=
@
projec
t
.
group_for_spec
(
'BananaLib'
,
:source_files
)
@group
=
@
su
t
.
group_for_spec
(
'BananaLib'
,
:source_files
)
end
end
it
"adds a file references to the given file"
do
it
"adds a file references to the given file"
do
ref
=
@
projec
t
.
add_file_reference
(
@file
,
@group
)
ref
=
@
su
t
.
add_file_reference
(
@file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Source Files/file.m'
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Source Files/file.m'
end
end
it
"it doesn't duplicate file references for a single path"
do
it
"it doesn't duplicate file references for a single path"
do
ref_1
=
@
projec
t
.
add_file_reference
(
@file
,
@group
)
ref_1
=
@
su
t
.
add_file_reference
(
@file
,
@group
)
ref_2
=
@
projec
t
.
add_file_reference
(
@file
,
@group
)
ref_2
=
@
su
t
.
add_file_reference
(
@file
,
@group
)
ref_1
.
uuid
.
should
==
ref_2
.
uuid
ref_1
.
uuid
.
should
==
ref_2
.
uuid
@group
.
children
.
count
.
should
==
1
@group
.
children
.
count
.
should
==
1
end
end
it
"raises if the given path is not absolute"
do
it
"raises if the given path is not absolute"
do
should
.
raise
ArgumentError
do
should
.
raise
ArgumentError
do
@
projec
t
.
add_file_reference
(
'relative/path/to/file.m'
,
@group
)
@
su
t
.
add_file_reference
(
'relative/path/to/file.m'
,
@group
)
end
.
message
.
should
.
match
/Paths must be absolute/
end
.
message
.
should
.
match
/Paths must be absolute/
end
end
...
@@ -182,26 +182,26 @@ module Pod
...
@@ -182,26 +182,26 @@ module Pod
describe
"#reference_for_path"
do
describe
"#reference_for_path"
do
before
do
before
do
@
projec
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@
su
t
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"file.m"
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"file.m"
@group
=
@
projec
t
.
group_for_spec
(
'BananaLib'
,
:source_files
)
@group
=
@
su
t
.
group_for_spec
(
'BananaLib'
,
:source_files
)
@
projec
t
.
add_file_reference
(
@file
,
@group
)
@
su
t
.
add_file_reference
(
@file
,
@group
)
end
end
it
"returns the reference for the given path"
do
it
"returns the reference for the given path"
do
ref
=
@
projec
t
.
reference_for_path
(
@file
)
ref
=
@
su
t
.
reference_for_path
(
@file
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Source Files/file.m'
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Source Files/file.m'
end
end
it
"returns nil if no reference for the given path is available"
do
it
"returns nil if no reference for the given path is available"
do
another_file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"another_file.m"
another_file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
"another_file.m"
ref
=
@
projec
t
.
reference_for_path
(
another_file
)
ref
=
@
su
t
.
reference_for_path
(
another_file
)
ref
.
should
.
be
.
nil
ref
.
should
.
be
.
nil
end
end
it
"raises if the given path is not absolute"
do
it
"raises if the given path is not absolute"
do
should
.
raise
ArgumentError
do
should
.
raise
ArgumentError
do
@
projec
t
.
reference_for_path
(
'relative/path/to/file.m'
)
@
su
t
.
reference_for_path
(
'relative/path/to/file.m'
)
end
.
message
.
should
.
match
/Paths must be absolute/
end
.
message
.
should
.
match
/Paths must be absolute/
end
end
...
@@ -210,16 +210,16 @@ module Pod
...
@@ -210,16 +210,16 @@ module Pod
#----------------------------------------#
#----------------------------------------#
it
"adds the Podfile configured as a Ruby file"
do
it
"adds the Podfile configured as a Ruby file"
do
@
projec
t
.
add_podfile
(
config
.
sandbox
.
root
+
'../Podfile'
)
@
su
t
.
add_podfile
(
config
.
sandbox
.
root
+
'../Podfile'
)
f
=
@
projec
t
[
'Podfile'
]
f
=
@
su
t
[
'Podfile'
]
f
.
source_tree
.
should
==
'SOURCE_ROOT'
f
.
source_tree
.
should
==
'SOURCE_ROOT'
f
.
xc_language_specification_identifier
.
should
==
'xcode.lang.ruby'
f
.
xc_language_specification_identifier
.
should
==
'xcode.lang.ruby'
f
.
path
.
should
==
'../Podfile'
f
.
path
.
should
==
'../Podfile'
end
end
it
"returns the file reference of the Podfile"
do
it
"returns the file reference of the Podfile"
do
ref
=
@
projec
t
.
add_podfile
(
config
.
sandbox
.
root
+
'../Podfile'
)
ref
=
@
su
t
.
add_podfile
(
config
.
sandbox
.
root
+
'../Podfile'
)
@
projec
t
.
podfile
.
should
.
equal
(
ref
)
@
su
t
.
podfile
.
should
.
equal
(
ref
)
end
end
end
end
...
@@ -231,18 +231,18 @@ module Pod
...
@@ -231,18 +231,18 @@ module Pod
describe
"#create_group_if_needed"
do
describe
"#create_group_if_needed"
do
it
"creates a new group"
do
it
"creates a new group"
do
group
=
@
projec
t
.
send
(
:create_group_if_needed
,
'Group'
)
group
=
@
su
t
.
send
(
:create_group_if_needed
,
'Group'
)
group
.
hierarchy_path
.
should
==
'/Group'
group
.
hierarchy_path
.
should
==
'/Group'
end
end
it
"creates a new group"
do
it
"creates a new group"
do
group
=
@
project
.
send
(
:create_group_if_needed
,
'Group'
,
@projec
t
.
pods
)
group
=
@
sut
.
send
(
:create_group_if_needed
,
'Group'
,
@su
t
.
pods
)
group
.
hierarchy_path
.
should
==
'/Pods/Group'
group
.
hierarchy_path
.
should
==
'/Pods/Group'
end
end
it
"returns an already existing group"
do
it
"returns an already existing group"
do
group_1
=
@
projec
t
.
send
(
:create_group_if_needed
,
'Group'
)
group_1
=
@
su
t
.
send
(
:create_group_if_needed
,
'Group'
)
group_2
=
@
projec
t
.
send
(
:create_group_if_needed
,
'Group'
)
group_2
=
@
su
t
.
send
(
:create_group_if_needed
,
'Group'
)
group_1
.
should
.
be
.
equal
(
group_2
)
group_1
.
should
.
be
.
equal
(
group_2
)
end
end
...
@@ -253,16 +253,16 @@ module Pod
...
@@ -253,16 +253,16 @@ module Pod
describe
"#spec_group"
do
describe
"#spec_group"
do
before
do
before
do
@
projec
t
.
add_pod_group
(
'JSONKit'
,
config
.
sandbox
.
pod_dir
(
'JSONKit'
))
@
su
t
.
add_pod_group
(
'JSONKit'
,
config
.
sandbox
.
pod_dir
(
'JSONKit'
))
end
end
it
"returns the Pod group for root specifications"
do
it
"returns the Pod group for root specifications"
do
group
=
@
projec
t
.
send
(
:spec_group
,
'JSONKit'
)
group
=
@
su
t
.
send
(
:spec_group
,
'JSONKit'
)
group
.
hierarchy_path
.
should
==
'/Pods/JSONKit'
group
.
hierarchy_path
.
should
==
'/Pods/JSONKit'
end
end
it
"returns the group for subspecs"
do
it
"returns the group for subspecs"
do
group
=
@
projec
t
.
send
(
:spec_group
,
'JSONKit/Parsing'
)
group
=
@
su
t
.
send
(
:spec_group
,
'JSONKit/Parsing'
)
group
.
hierarchy_path
.
should
==
'/Pods/JSONKit/Subspecs/Parsing'
group
.
hierarchy_path
.
should
==
'/Pods/JSONKit/Subspecs/Parsing'
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