mockingbird icon indicating copy to clipboard operation
mockingbird copied to clipboard

How to use mockingbird in the custom pod.

Open glve1027 opened this issue 3 years ago • 1 comments

New Issue Checklist

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

glve1027 avatar Jun 16 '22 09:06 glve1027

Facing the same issue.

Any solutions so far?

RayanSaeed avatar Aug 18 '22 12:08 RayanSaeed