feedhenry / fh-ios-sdk

FeedHenry iOS (Objective-C) SDK
http://feedhenry.org
Apache License 2.0
6 stars 16 forks source link

Prevent init from calling success and error. Add unit test coverage. #43

Closed cianclarke closed 9 years ago

cianclarke commented 9 years ago

Previously, our unit tests in FHTests.m never tested anything. They included a mock HTTP client, so avoided a good chunk of the SDK, and since we moved to blocks, the assertions contained within the block never impacted the outcome of the test - we were effectively testing nothing.
This adds Nocilla, and tests a number of scenarios which we've come up against the past number of days which may not have had test coverage. Turns out there are no issues in the SDK, but now we have unit tests asserting this.
There's huge room for improvement here, I think there's a lot we could expand upon - but right now, some tests are better than no tests!

cianclarke commented 9 years ago

..new tests pass first time. Well, that was unexpected. travisCI && Cocoapods FTW

corinnekrych commented 9 years ago

+1 to merge it Unit tests run well. For mocking http layer we use OHHTTPStubs (but only available to mock NSURLSession) so Nocilla makes sense to mock ASIHttp layer.

wei-lee commented 9 years ago

@cianclarke This looks good. But which line is the fix to preventing init from calling success and error?

cianclarke commented 9 years ago

@corinnekrych Thanks for the review - yeah I really just picked most popular HTTP mocker I could find!

@wei-lee Thanks for reviewing - here's the fix to prevent init and success from calling https://github.com/feedhenry/fh-ios-sdk/pull/43/files#diff-8e87674fe8b32be696588c31def56447R88

Also this important fix re: problem we discussed yest: https://github.com/feedhenry/fh-ios-sdk/pull/43/files#diff-8e87674fe8b32be696588c31def56447R87

Thanks again for jumping on this issue so quick @corinnekrych @wei-lee