From 4fefe6b0e661cae1217267ed939c8967bf7c913a Mon Sep 17 00:00:00 2001 From: Ilia Kolo Date: Fri, 29 Nov 2019 21:36:19 +0200 Subject: [PATCH] fix: add cocoapods requirement (#867) * Add cocoapods requirement As file is using `Pod`, cocoapods should be imported. * Install cocoapods prior testing * Drop mocking cocoapods * Update tests with last changes --- .circleci/config.yml | 8 ++++++++ packages/platform-ios/native_modules.rb | 24 ++---------------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d61a0218d..bec565e16 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: @@ -72,6 +79,7 @@ jobs: cocoa-pods: executor: noderuby steps: + - install-cocoapods - run-cocoa-pods-tests unit-tests: executor: node8 diff --git a/packages/platform-ios/native_modules.rb b/packages/platform-ios/native_modules.rb index 431282afb..7b3487a34 100644 --- a/packages/platform-ios/native_modules.rb +++ b/packages/platform-ios/native_modules.rb @@ -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) @@ -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 = { @@ -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