A light-weight TDD / BDD framework for Objective-C & Cocoa
i have got simple (i guess) question.
I want to make a feature test in my app with Specta and KIF. The problem is that i am setting dependency in viewDidLoad method of my View Controller, and in beforeEach method of my spec i'm injecting fake object just to not hit the network.
The result is wrong because viewDidLoad is being called before beforeEach method in specs.
Is there a possibility to set dependencies before AppDelegate loads root view controller so everything is set up properly?
Source: (StackOverflow)
I am using cocoapods-keys and trying to test if the method returns valid url with secret API key.
Test suite looks like this:
it(@"should return valid url for api", ^{
NSURL *url = [APIRoutes apiURLWithPath:path parameters:nil];
expect([url absoluteString]).to.equal([NSString stringWithFormat:@"http://www.api.com/api/v2/places?api_key=MY_API_KEY"]);
});
But the real method is returning my valid API key which is hash (e.g. 8s97f89asf89asf987saf) and my test fails. How can I test this? Should I create fake implementation of my class in my test file?
Source: (StackOverflow)