mockingbird
mockingbird copied to clipboard
How to use mockingbird in the custom pod.
New Issue Checklist
- [x] I updated the framework and generator to the latest version
- [x] I searched the existing GitHub issues and list of common problems
Overview
A summary of the issue.
- I use
pod lib create TestBird. - Add a class in the pod
TestBird.
import Foundation
class Bird {
func canFly() -> Bool {
return false
}
}
- Update Podfile with
use_frameworks!
platform :ios, '9.0'
target 'TestBird_Example' do
pod 'TestBird', :path => '../'
target 'TestBird_Tests' do
inherit! :search_paths
//added here!!
use_frameworks!
pod 'MockingbirdFramework', '~> 0.20'
pod 'FBSnapshotTestCase' , '~> 2.1.4'
end
end
- Configure the test target:
Pods/MockingbirdFramework/mockingbird configure TestBird_Tests -- --targets TestBird_Example
- Then Can not build my test case. Do I need to combine all the codes into one project and test it?
Error Message:
'mock' is unavailable: No generated mock for this type; try building the test target (⇧⌘U) to generate mocks
import XCTest
import Mockingbird
@testable import TestBird
class Tests: XCTestCase {
func testCat() {
let cat = mock(Bird.self)
}
}
Example
A minimal example of the code being tested along with the test case.
Expected Behavior
If needed, provide a short description of how it should work.
Environment
- Mockingbird CLI version (
mockingbird version) - Xcode and Swift version (
swift --version) - Package manager (CocoaPods, Carthage, SPM project, SPM package)
- Unit testing framework (XCTest, Quick/Nimble)
- Custom configuration
- [x] Mockingbird ignore files
- [x] Supporting source files
Facing the same issue.
Any solutions so far?