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
81ee36aa
Commit
81ee36aa
authored
Nov 15, 2015
by
Boris Bügling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stub `pathname` in relevant places.
parent
672e2804
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
installer_spec.rb
spec/unit/installer_spec.rb
+10
-4
project_spec.rb
spec/unit/project_spec.rb
+8
-0
validator_spec.rb
spec/unit/validator_spec.rb
+3
-1
No files found.
spec/unit/installer_spec.rb
View file @
81ee36aa
...
...
@@ -252,24 +252,30 @@ module Pod
pod
'monkey'
,
:path
=>
(
fixture_path
+
'monkey'
).
to_s
end
@lockfile
=
generate_lockfile
@file
=
Pathname
(
'/yolo.m'
)
@file
.
stubs
(
:realpath
).
returns
(
@file
)
@libThing
=
Pathname
(
'/libThing.a'
)
@libThing
.
stubs
(
:realpath
).
returns
(
@libThing
)
end
it
'detects transitive static dependencies which are linked directly to the user target'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
Pathname
(
'/libThing.a'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@libThing
])
@installer
=
Installer
.
new
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
raise
(
Informative
)
{
@installer
.
install!
}.
message
.
should
.
match
/transitive.*libThing/
end
it
'allows transitive static dependencies which contain other source code'
do
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
Pathname
(
'/yolo.m'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
Pathname
(
'/libThing.a'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
@file
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@libThing
])
@installer
=
Installer
.
new
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
not
.
raise
(
Informative
)
{
@installer
.
install!
}
end
it
'allows transitive static dependencies when both dependencies are linked against the user target'
do
PodTarget
.
any_instance
.
stubs
(
:should_build?
=>
false
)
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
Pathname
(
'/libThing.a'
)
])
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:vendored_libraries
).
returns
([
@libThing
])
@installer
=
Installer
.
new
(
config
.
sandbox
,
@podfile
,
@lockfile
)
should
.
not
.
raise
(
Informative
)
{
@installer
.
install!
}
end
...
...
spec/unit/project_spec.rb
View file @
81ee36aa
...
...
@@ -174,26 +174,31 @@ module Pod
end
it
'adds a file references to the given file'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@file
)
ref
=
@project
.
add_file_reference
(
@file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/file.m'
end
it
'adds subgroups for a file reference if requested'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@nested_file
)
ref
=
@project
.
add_file_reference
(
@nested_file
,
@group
,
true
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Dir/SubDir/nested_file.m'
end
it
'does not add subgroups for a file reference if not requested'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@nested_file
)
ref
=
@project
.
add_file_reference
(
@nested_file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/nested_file.m'
end
it
'does not add subgroups for a file reference if requested not to'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@nested_file
)
ref
=
@project
.
add_file_reference
(
@nested_file
,
@group
,
false
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/nested_file.m'
end
it
"it doesn't duplicate file references for a single path"
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@file
)
ref_1
=
@project
.
add_file_reference
(
@file
,
@group
)
ref_2
=
@project
.
add_file_reference
(
@file
,
@group
)
ref_1
.
uuid
.
should
==
ref_2
.
uuid
...
...
@@ -201,12 +206,14 @@ module Pod
end
it
'creates variant group for localized file'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@localized_file
)
ref
=
@project
.
add_file_reference
(
@localized_file
,
@group
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Foo/Foo.strings'
ref
.
parent
.
class
.
should
==
Xcodeproj
::
Project
::
Object
::
PBXVariantGroup
end
it
'creates variant group for localized file in subgroup'
do
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@localized_file
)
ref
=
@project
.
add_file_reference
(
@localized_file
,
@group
,
true
)
ref
.
hierarchy_path
.
should
==
'/Pods/BananaLib/Dir/SubDir/Foo/Foo.strings'
ref
.
parent
.
class
.
should
==
Xcodeproj
::
Project
::
Object
::
PBXVariantGroup
...
...
@@ -312,6 +319,7 @@ module Pod
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
),
false
)
@file
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
+
'file.m'
@group
=
@project
.
group_for_spec
(
'BananaLib'
)
Pathname
.
any_instance
.
stubs
(
:realpath
).
returns
(
@file
)
@project
.
add_file_reference
(
@file
,
@group
)
end
...
...
spec/unit/validator_spec.rb
View file @
81ee36aa
...
...
@@ -729,9 +729,11 @@ module Pod
def
test_swiftpod
podspec
=
stub_podspec
(
/.*source_files.*/
,
'"source_files": "*.swift",'
)
file
=
write_podspec
(
podspec
)
pathname
=
Pathname
.
new
(
'/Foo.swift'
)
pathname
.
stubs
(
:realpath
).
returns
(
pathname
)
Podfile
::
TargetDefinition
.
any_instance
.
stubs
(
:uses_frameworks?
).
returns
(
true
)
Pod
::
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
Pathname
.
new
(
'/Foo.swift'
)
])
Pod
::
Sandbox
::
FileAccessor
.
any_instance
.
stubs
(
:source_files
).
returns
([
pathname
])
validator
=
Validator
.
new
(
file
,
SourcesManager
.
master
.
map
(
&
:url
))
validator
.
stubs
(
:build_pod
)
validator
.
stubs
(
:validate_url
)
...
...
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