convert ProjectMock path type from string to Pathname (#38085)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38085

Changelog: [Internal]

the path instance attribute on `Project` is not actually supposed to be `String`, but `Pathname`: https://www.rubydoc.info/github/CocoaPods/Xcodeproj/Xcodeproj/Project#path-instance_method

i need this actually to be a pathname, so doing the refactor in this diff

Reviewed By: cipolleschi

Differential Revision: D47041355

fbshipit-source-id: 8b43c3a6f1cbc0f930749f380bd9d06ed44c0c37
This commit is contained in:
Phillip Pan
2023-06-27 16:06:54 -07:00
committed by Facebook GitHub Bot
parent b9cf5a1c49
commit 2df19cec82
3 changed files with 11 additions and 8 deletions
@@ -119,7 +119,7 @@ class UserProjectMock
def initialize(path = "/test/path.xcproj", build_configurations = [], native_targets: [])
@path = path
@path = Pathname.new(path)
@build_configurations = build_configurations
@native_targets = native_targets
@save_invocation_count = 0
@@ -34,6 +34,9 @@ class Pathname
return @@pwd_invocation_count
end
def to_s
return @path
end
def self.reset()
@@pwd = ""
@@ -324,7 +324,7 @@ class UtilsTests < Test::Unit::TestCase
first_target = prepare_target("FirstTarget")
second_target = prepare_target("SecondTarget")
third_target = prepare_target("ThirdTarget")
user_project_mock = UserProjectMock.new("a/path", [
user_project_mock = UserProjectMock.new("/a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
@@ -434,7 +434,7 @@ class UtilsTests < Test::Unit::TestCase
first_target = prepare_target("FirstTarget")
second_target = prepare_target("SecondTarget")
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
user_project_mock = UserProjectMock.new("a/path", [
user_project_mock = UserProjectMock.new("/a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
@@ -492,7 +492,7 @@ class UtilsTests < Test::Unit::TestCase
}),
], nil)
user_project_mock = UserProjectMock.new("a/path", [
user_project_mock = UserProjectMock.new("/a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
@@ -644,7 +644,7 @@ class UtilsTests < Test::Unit::TestCase
DependencyMock.new("React-ImageManager"),
])
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
user_project_mock = UserProjectMock.new("a/path", [
user_project_mock = UserProjectMock.new("/a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
@@ -688,7 +688,7 @@ class UtilsTests < Test::Unit::TestCase
first_target = prepare_target("FirstTarget")
second_target = prepare_target("SecondTarget")
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
user_project_mock = UserProjectMock.new("a/path", [
user_project_mock = UserProjectMock.new("/a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
@@ -750,7 +750,7 @@ class UtilsTests < Test::Unit::TestCase
first_target = prepare_target("FirstTarget")
second_target = prepare_target("SecondTarget")
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
user_project_mock = UserProjectMock.new("a/path", [
user_project_mock = UserProjectMock.new("/a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
@@ -779,7 +779,7 @@ end
# ===== #
def prepare_empty_user_project_mock
return UserProjectMock.new("a/path", [
return UserProjectMock.new("/a/path", [
BuildConfigurationMock.new("Debug"),
BuildConfigurationMock.new("Release"),
])