Created
January 23, 2018 21:52
-
-
Save fabiothiroki/23394b775c8a950cd6e0a2180ea2227b to your computer and use it in GitHub Desktop.
NearbyPlacesServiceSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NearbyPlacesServiceSpec: XCTestCase { | |
private var container: Container! | |
private var placesDatasource: PlacesApiMock! | |
private var userLocationDatasource: UserLocationServiceMock! | |
private var nearbyPlacesService: NearbyPlacesService! | |
private let disposeBag = DisposeBag() | |
override func setUp() { | |
super.setUp() | |
// Omited the properties initalization | |
} | |
func testShouldRequestPlacesNearbyUserLocation() { | |
_ = nearbyPlacesService.fetchNearbyPlaces() | |
.subscribe(onNext: { (places) in | |
XCTAssertNotNil(places) | |
}, onError: { (_) in | |
XCTFail("Should not return error") | |
}).disposed(by: disposeBag) | |
let mockUserLatitude = userLocationDatasource.location.coordinate.latitude | |
let mockUserLongitude = userLocationDatasource.location.coordinate.longitude | |
XCTAssertEqual(placesDatasource.requestedLatitude, mockUserLatitude) | |
XCTAssertEqual(placesDatasource.requestedLongitude, mockUserLongitude) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment