Skip to content

Commit

Permalink
fix: add cocoapods requirement (react-native-community#867)
Browse files Browse the repository at this point in the history
* Add cocoapods requirement

As file is using `Pod`, cocoapods should be imported.

* Install cocoapods prior testing

* Drop mocking cocoapods

* Update tests with last changes
  • Loading branch information
Gray-Wind authored and thymikee committed Nov 29, 2019
1 parent e2be8a9 commit 4fefe6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ commands:
root: .
paths:
- .

install-cocoapods:
steps:
- attach_workspace:
at: ~/react-native-cli
- run: gem install cocoapods

run-lint:
steps:
- attach_workspace:
Expand Down Expand Up @@ -72,6 +79,7 @@ jobs:
cocoa-pods:
executor: noderuby
steps:
- install-cocoapods
- run-cocoa-pods-tests
unit-tests:
executor: node8
Expand Down
24 changes: 2 additions & 22 deletions packages/platform-ios/native_modules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# imports those into your current target.
#
require 'pathname'
require 'cocoapods'

def use_native_modules!(config = nil)
if (config.is_a? String)
Expand Down Expand Up @@ -106,27 +107,6 @@ def use_native_modules!(config = nil)
require "minitest/spec"
require "minitest/autorun"

# Define this here, because we’re not actually loading this code.
module Pod
class Specification
end

module UI
end
end

# CocoaPods loads ActiveSupport, but we’re not doing that here just for the test.
class Array
def to_sentence
size == 1 ? self[0] : "#{self[0..-2].join(", ")}, and #{self[-1]}"
end
end
class String
def pluralize(count)
count == 1 ? self : "#{self}s"
end
end

describe "use_native_modules!" do
before do
@script_phase = {
Expand Down Expand Up @@ -238,7 +218,7 @@ def pluralize(count)
})
@printed_messages.must_equal [
"Detected React Native module pod for ios-dep",
"Detected React Native module pods for ios-dep, and ios-dep"
"Detected React Native module pods for ios-dep and ios-dep"
]
end

Expand Down

0 comments on commit 4fefe6b

Please sign in to comment.