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

Encodable support #7

Merged
merged 1 commit into from
Jul 9, 2017
Merged

Encodable support #7

merged 1 commit into from
Jul 9, 2017

Conversation

stephencelis
Copy link
Member

Allows us to snap against any Encodable type. Uses JSONEncoder under the hood right now, but we probably want to use our own encoder in the future.

@@ -119,3 +120,25 @@ public func assertSnapshot<S: Snapshot>(
return
}
}

public func assertSnapshot<S: Encodable>(
encoding snapshot: S,
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed the keyword here since there's ambiguity:

assertSnapshot(matching: data)
// vs.
assertSnapshot(encoding: data)

Copy link
Member

@mbrandonw mbrandonw left a comment

Choose a reason for hiding this comment

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

booooom!

_ file: StaticString = #file,
_ function: String = #function,
_ line: UInt = #line)
pathExtension: String? = nil,
Copy link
Member

Choose a reason for hiding this comment

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

nice nice! so this will allow me to override extension when doing a plain text snapshot?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep!

@stephencelis stephencelis merged commit f4125b4 into master Jul 9, 2017
@stephencelis stephencelis deleted the encodable branch July 9, 2017 13:17
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.

None yet

2 participants