@@ -71,19 +71,19 @@ - (void)testSuccessfullLogin {
7171
7272 XCTestExpectation *expectation = [self expectationWithDescription: @" logged in" ];
7373 [self .provider signInWithEmail: nil
74- presentingViewController: nil
75- completion: ^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) {
76- XCTAssertNil (error);
77- XCTAssertNotNil (credential);
78- FIRAuthCredential *expectedCredential = [FIRFacebookAuthProvider credentialWithAccessToken: testToken];
79- XCTAssertEqualObjects (credential.provider , expectedCredential.provider );
80- XCTAssertNil (self.provider .idToken );
81-
82- // verify that we are using token from server
83- OCMVerify ([mockToken tokenString ]);
84-
85- [expectation fulfill ];
86- }];
74+ presentingViewController: nil
75+ completion: ^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) {
76+ XCTAssertNil (error);
77+ XCTAssertNotNil (credential);
78+ FIRAuthCredential *expectedCredential = [FIRFacebookAuthProvider credentialWithAccessToken: testToken];
79+ XCTAssertEqualObjects (credential.provider , expectedCredential.provider );
80+ XCTAssertNil (self.provider .idToken );
81+
82+ // verify that we are using token from server
83+ OCMVerify ([mockToken tokenString ]);
84+
85+ [expectation fulfill ];
86+ }];
8787 [self waitForExpectationsWithTimeout: 0.1 handler: ^(NSError * _Nullable error) {
8888 XCTAssertNil (error);
8989 }];
@@ -107,19 +107,19 @@ - (void)testCancelLogin {
107107
108108 XCTestExpectation *expectation = [self expectationWithDescription: @" logged in" ];
109109 [self .provider signInWithEmail: nil
110- presentingViewController: nil
111- completion: ^(FIRAuthCredential * _Nullable credential,
112- NSError * _Nullable error) {
113- XCTAssertNotNil (error);
114- XCTAssertEqual (error.code , FIRAuthUIErrorCodeUserCancelledSignIn);
115- XCTAssertNil (credential);
116- XCTAssertNil (self.provider .idToken );
117-
118- // verify that we are not using token from server if user canceled request
119- OCMReject ([mockToken tokenString ]);
120-
121- [expectation fulfill ];
122- }];
110+ presentingViewController: nil
111+ completion: ^(FIRAuthCredential * _Nullable credential,
112+ NSError * _Nullable error) {
113+ XCTAssertNotNil (error);
114+ XCTAssertEqual (error.code , FIRAuthUIErrorCodeUserCancelledSignIn);
115+ XCTAssertNil (credential);
116+ XCTAssertNil (self.provider .idToken );
117+
118+ // verify that we are not using token from server if user canceled request
119+ OCMReject ([mockToken tokenString ]);
120+
121+ [expectation fulfill ];
122+ }];
123123 [self waitForExpectationsWithTimeout: 0.1 handler: ^(NSError * _Nullable error) {
124124 XCTAssertNil (error);
125125 }];
@@ -132,15 +132,15 @@ - (void)testErrorLogin {
132132
133133 XCTestExpectation *expectation = [self expectationWithDescription: @" logged in" ];
134134 [self .provider signInWithEmail: nil
135- presentingViewController: nil
136- completion: ^(FIRAuthCredential * _Nullable credential,
137- NSError * _Nullable error) {
138- XCTAssertNotNil (error);
139- XCTAssertEqual (error.userInfo [NSUnderlyingErrorKey ], testError);
140- XCTAssertNil (credential);
141- XCTAssertNil (self.provider .idToken );
142- [expectation fulfill ];
143- }];
135+ presentingViewController: nil
136+ completion: ^(FIRAuthCredential * _Nullable credential,
137+ NSError * _Nullable error) {
138+ XCTAssertNotNil (error);
139+ XCTAssertEqual (error.userInfo [NSUnderlyingErrorKey ], testError);
140+ XCTAssertNil (credential);
141+ XCTAssertNil (self.provider .idToken );
142+ [expectation fulfill ];
143+ }];
144144 [self waitForExpectationsWithTimeout: 0.1 handler: ^(NSError * _Nullable error) {
145145 XCTAssertNil (error);
146146 }];
@@ -150,19 +150,21 @@ - (void)testSignOut {
150150
151151 // used to make possible initialization of FIRFacebookAuthUI
152152 id mockProviderClass = OCMClassMock ([FIRFacebookAuthUI class ]);
153- OCMStub (ClassMethod ([mockProviderClass frameworkBundle ])).andReturn ([NSBundle bundleForClass: [self class ]]);
153+ OCMExpect (ClassMethod ([mockProviderClass frameworkBundle ])).andReturn ([NSBundle bundleForClass: [self class ]]);
154154
155155 id mockProvider = OCMPartialMock ([[FIRFacebookAuthUI alloc ] init ]);
156156 id mockFacebookManager = OCMClassMock ([FBSDKLoginManager class ]);
157157
158158 // stub login manager
159- OCMStub (ClassMethod ([mockProvider frameworkBundle ])).andReturn ([NSBundle bundleForClass: [self class ]]);
160- OCMStub ([mockProvider createLoginManger ]).andReturn (mockFacebookManager);
159+ OCMExpect (ClassMethod ([mockProvider frameworkBundle ])).andReturn ([NSBundle bundleForClass: [self class ]]);
160+ OCMExpect ([mockProvider createLoginManger ]).andReturn (mockFacebookManager);
161161 [mockProvider configureProvider ];
162162
163+ OCMExpect ([mockFacebookManager logOut ]);
163164 [mockProvider signOut ];
164165
165- OCMVerify ([mockFacebookManager logOut ]);
166+ OCMVerifyAll (mockFacebookManager);
167+ OCMVerifyAll (mockProvider);
166168
167169}
168170
0 commit comments