Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
Mock template was customised to add single feature, which I named root-typealiases
Root typealiases are placed in root of the resulting file and are NOT nested inside type (as typealiases do).
They are meant to solve problem partially described in https://github.com/MakeAWishFoundation/SwiftyMocky/issues/184
Problem occurs when mock is generated for protocol name, which clashes with type from another library.
Since there is no concept of module in Sourcery/SwiftyMocky, compiler gets confused which type should be used for inheritance, for example:
Mock template was customised to add single feature, which I named
root-typealiases
Root typealiases are placed in root of the resulting file and are NOT nested inside type (as typealiases do). They are meant to solve problem partially described in https://github.com/MakeAWishFoundation/SwiftyMocky/issues/184 Problem occurs when mock is generated for protocol name, which clashes with type from another library. Since there is no concept of module in
Sourcery/SwiftyMocky
, compiler gets confused which type should be used for inheritance, for example:Typealias example:
Our module:
Another module:
Resulting
Mock.generated.swift
:In this implementation this problem can be fixed by adding annotation for Feature protocol, like this:
Resulting
Mock.generated.swift
: