I am trying to set up the Typhoon framework with an example project and it works fine when I run the simulator but its giving me an error when I try to run tests. The error is the following:
NSInvalidArgumentException', reason: 'Class 'DI_Example.MyAssembly' is not a sub-class of TyphoonAssembly'
Now, I read here and here that this is caused by the Typhoon package being linked twice because of CocoaPods. So this is my Podfile and it doesn't seem that it should be linked it 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 tests target from applicaiton-style to logic-style everything seems to work fine (I am assuming because the package is not imported twice). Can anyone spot a problem with what I am doing?
It seems that the error is thrown before even hitting my test so I am guessing it has to do with linking the two targets
Here is my test (which is passing if I set the Host Application to None
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")
}
So I managed to resolve the issue. The problem was that because I did not have any dependencies on the test target I did not have Pods-PocketForecastTests.debug.xcconfig
so in my project configuration I used the same config file as the app target which I guess causes it to be linked twice.