Skip to content

Commit 3f95f59

Browse files
FIRApp tests fixes (#7157)
* Core pospec: keep deployment targets in sync * FIRAppTest: tear down race condition workaround * style
1 parent 435173a commit 3f95f59

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

FirebaseCore.podspec

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
1717
}
1818

1919
s.social_media_url = 'https://twitter.com/Firebase'
20-
s.ios.deployment_target = '9.0'
21-
s.osx.deployment_target = '10.12'
22-
s.tvos.deployment_target = '10.0'
23-
s.watchos.deployment_target = '6.0'
20+
21+
ios_deployment_target = '9.0'
22+
osx_deployment_target = '10.12'
23+
tvos_deployment_target = '10.0'
24+
watchos_deployment_target = '6.0'
25+
26+
s.ios.deployment_target = ios_deployment_target
27+
s.osx.deployment_target = osx_deployment_target
28+
s.tvos.deployment_target = tvos_deployment_target
29+
s.watchos.deployment_target = watchos_deployment_target
2430

2531
s.cocoapods_version = '>= 1.4.0'
2632
s.prefix_header_file = false
@@ -50,7 +56,7 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
5056
'OTHER_CFLAGS' => '-fno-autolink'
5157
}
5258
s.test_spec 'unit' do |unit_tests|
53-
unit_tests.platforms = {:ios => '8.0', :osx => '10.11', :tvos => '10.0'}
59+
unit_tests.platforms = {:ios => ios_deployment_target, :osx => osx_deployment_target, :tvos => tvos_deployment_target}
5460
unit_tests.source_files = [
5561
'FirebaseCore/Tests/Unit/**/*.[mh]',
5662
'SharedTestUtilities/FIROptionsMock.[mh]',
@@ -61,7 +67,7 @@ Firebase Core includes FIRApp and FIROptions which provide central configuration
6167
end
6268

6369
s.test_spec 'swift-unit' do |swift_unit_tests|
64-
swift_unit_tests.platforms = {:ios => '8.0', :osx => '10.11', :tvos => '10.0'}
70+
swift_unit_tests.platforms = {:ios => ios_deployment_target, :osx => osx_deployment_target, :tvos => tvos_deployment_target}
6571
swift_unit_tests.source_files = [
6672
'FirebaseCore/Tests/SwiftUnit/**/*.swift',
6773
'FirebaseCore/Tests/SwiftUnit/**/*.h',

FirebaseCore/Tests/Unit/FIRAppTest.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ - (void)setUp {
6565
[super setUp];
6666
[FIROptions resetDefaultOptions];
6767
[FIRApp resetApps];
68+
// TODO: Don't mock the class we are testing.
6869
_appClassMock = OCMClassMock([FIRApp class]);
6970
_observerMock = OCMObserverMock();
7071
_mockCoreDiagnosticsConnector = OCMClassMock([FIRCoreDiagnosticsConnector class]);
@@ -81,7 +82,14 @@ - (void)setUp {
8182
}
8283

8384
- (void)tearDown {
85+
// Wait for background operations to complete.
86+
NSDate *waitUntilDate = [NSDate dateWithTimeIntervalSinceNow:0.5];
87+
while ([[NSDate date] compare:waitUntilDate] == NSOrderedAscending) {
88+
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
89+
}
90+
8491
[_appClassMock stopMocking];
92+
_appClassMock = nil;
8593
[_notificationCenter removeObserver:_observerMock];
8694
_observerMock = nil;
8795
_notificationCenter = nil;

0 commit comments

Comments
 (0)