Swift Typhoon error in target tests - not subclassing typhoon assembly

I'm trying to set up a Typhoon framework with a sample project and it works great when I run the simulator, but it gives me an error when I try to run the tests. The error is as follows:

NSInvalidArgumentException ', Reason:' Class' DI_Example.MyAssembly 'is not a subclass of TyphoonAssembly'

Now I read here and here that this is caused by the Typhoon package is twice linked to CocoaPods. So this is my subfile and doesn't look like it needs to be linked twice.

platform :ios, '8.0'

target 'DI_Example', :exclusive => true do
    pod 'Typhoon', '~> 2.3' end

target 'DI_ExampleTests', :exclusive => true do end

inhibit_all_warnings!

      

Also when I change the testing target from applicaiton-style to boolean style everything seems to work fine (I assume because the package is not imported twice). Can anyone spot a problem with what I am doing?

It seems that the error was thrown before I hit my test, so I assume it is related to the binding of the two targets

Here is my test (which passes if I set Host Application to No

var controller: HomeViewController!
override func setUp() {
    super.setUp()
    let ctrlAssembly = ControllersAssembly()
    let blAssembly = BusinessLogicAssembly()
    ctrlAssembly.blAssembly = blAssembly
    let factory = TyphoonBlockComponentFactory(assemblies: [blAssembly, ctrlAssembly])
    let configurer = TyphoonConfigPostProcessor()
    configurer.useResourceWithName("Info.plist")
    factory.attachPostProcessor(configurer)


    controller = factory.componentForKey("homeViewController") as HomeViewController
}

func testControllerTitle() {
    // Arrange

    // Act
    controller.viewDidLoad()

    // Assert
    println(controller.title)
    XCTAssertTrue(controller.title == "Root View", "Title is set")
}

      

+3


source to share


1 answer


So I managed to solve the problem. The problem was that since I didn't have any dependencies on the target, I didn't Pods-PocketForecastTests.debug.xcconfig

, so in my project config I used the same config file as the target application program which I think forces it twice to contact.



+2


source







All Articles