Skip to content

Commit

Permalink
convert ProjectMock path type from string to Pathname (#38085)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
philIip authored and facebook-github-bot committed Jun 27, 2023
1 parent b9cf5a1 commit 2df19ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def self.pwd_invocation_count
return @@pwd_invocation_count
end

def to_s
return @path
end

def self.reset()
@@pwd = ""
Expand Down
14 changes: 7 additions & 7 deletions packages/react-native/scripts/cocoapods/__tests__/utils-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def test_fixLibrarySearchPaths_correctlySetsTheSearchPathsForAllProjects
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"),
],
Expand Down Expand Up @@ -434,7 +434,7 @@ def test_applyMacCatalystPatches_correctlyAppliesNecessaryPatches
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"),
],
Expand Down Expand Up @@ -492,7 +492,7 @@ def test_applyXcode15Patch_correctlyAppliesNecessaryPatch
}),
], nil)

user_project_mock = UserProjectMock.new("a/path", [
user_project_mock = UserProjectMock.new("/a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
Expand Down Expand Up @@ -644,7 +644,7 @@ def test_updateSearchPaths_whenUseFrameworks_addsSearchPaths
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"),
],
Expand Down Expand Up @@ -688,7 +688,7 @@ def test_updateSearchPaths_whenNotUseFrameworks_addsSearchPaths
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"),
],
Expand Down Expand Up @@ -750,7 +750,7 @@ def test_applyFlagsForFabric_whenFabricDisabled_doNothing
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"),
],
Expand Down Expand Up @@ -779,7 +779,7 @@ def test_applyFlagsForFabric_whenFabricDisabled_doNothing
# ===== #

def prepare_empty_user_project_mock
return UserProjectMock.new("a/path", [
return UserProjectMock.new("/a/path", [
BuildConfigurationMock.new("Debug"),
BuildConfigurationMock.new("Release"),
])
Expand Down

0 comments on commit 2df19ce

Please sign in to comment.