EzDevInfo.com

specta

A light-weight TDD / BDD framework for Objective-C & Cocoa

Feature tests with KIF: beforeEach is called after my view controller is loaded?

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)

Is there a way to get Teamcity to interpret Specta test output?

I am using Specta testing framework for testing an ios mobile application. Teamcity does not do a very good job at parsing the test output and listing which tests failed (like it does with rspec). Is there a way to get Teamcity to play nicely with Specta?


Source: (StackOverflow)

Advertisements

Unit testing secret keys

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)