im using swift with typhoon and cocopod. Everything worked fine until I started writing Integrationtest (according to Typhoon-Example-App Test ) for my Typhoon component. I wanted to set the TyphoonFactory in the Test setUp() method in the same way as in AppDelegate . When I run the test, I always get
TyphoonBlockComponentFactory assertIsAssembly:] + 244: ERROR: MyApp.MyAssembly is not a subclass of TyphoonAssembly
Typhoon error (using the kindOfClass method under the hood.) The same code works fine in AppDelegate , and I can't figure out what is wrong.
To test this behavior, I performed an isKindOfClass check in the stand classes (see code below):
- AppDelegate -> true
- MyComponentTest β false
Can anyone help me? thanks a lot!
Podfile
inhibit_all_warnings! target "MyApp" do pod 'Typhoon', '2.1.0' end target "MyAppTests" do pod 'Typhoon', '2.1.0' end
MyAssembly.swift
public class MyAssembly : TyphoonAssembly{
AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { β¦ var assembly : MyAssembly = MyAssembly() //Always returns βtrue" println("Is type of class: \(assembly.isKindOfClass(TyphoonAssembly))") β¦ }
MyComponentTest.swift
import XCTest import MyApp class MyComponentTest: XCTestCase { override func setUp() { super.setup() var assembly : MyAssembly = MyAssembly() //Always returns βfalse"! println("Is type of class: \(assembly.isKindOfClass(TyphoonAssembly))") //Error is thrown βMyApp.MyAssembly is not a sub-class of TyphoonAssembly" var factory : TyphoonComponentFactory = TyphoonBlockComponentFactory(assembly: assembly) as TyphoonComponentFactory } }
source share