Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/exclude classes protocols #112

Merged

Conversation

nxtstep
Copy link
Contributor

@nxtstep nxtstep commented Feb 27, 2017

This PR adds the optional feature to exclude certain classes and protocols from being mocked.

Use case:

  • Protocol with associatedType(s) has default extension methods that we want to mock in concrete class that conforms to this protocol.
  • And we might want to mock these default protocol extension implementations.

So we do need the protocol to be defined as input files for inheritance. But we exclude the protocol as being mock 'stand-alone'.

@nxtstep
Copy link
Contributor Author

nxtstep commented Mar 28, 2017

@TadeasKriz and this one as well ;)

@@ -68,6 +70,19 @@ public struct GenerateMocksCommand: CommandProtocol {
return FileRepresentation(sourceFile: $0.sourceFile, declarations: declarations)
}.filter { !$0.declarations.isEmpty }
}

private func removeClassedAndProtocols(from files: [FileRepresentation], in excluded: [String]) -> [FileRepresentation] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: removeClassedAndProtocols

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers @sparkesix for your sharp eye

@nxtstep nxtstep force-pushed the feature/exclude-classes-protocols branch from 739cb97 to 81a37c0 Compare March 29, 2017 07:54
@TadeasKriz
Copy link
Member

Hi, sorry for the long delay. I finally merged huge change and I'd like to ask you if you could try and rebase this PR on top of current master. Then I'd like to merge it. Thanks!

@nxtstep nxtstep force-pushed the feature/exclude-classes-protocols branch from 81a37c0 to 8d09211 Compare April 25, 2017 21:13
@TadeasKriz TadeasKriz merged commit 8d09211 into Brightify:master Apr 27, 2017
@TadeasKriz
Copy link
Member

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants