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

Add an overload for it which takes Behavior as a parameter #907

wants to merge 2 commits into
base: main
Choose a base branch


Copy link

@VojtaStavik VojtaStavik commented Jul 22, 2019

The PR is a byproduct of my article about using Behavior in Quick.

Sometimes if find it difficult to define Behavior's name such that it works nicely with itBehavesLike. As a workaround, I use a custom overload for it which accepts Behavior as a parameter.


class ShouldNotHaveMemoryLeaks<T>: Behavior<T> where T: AnyObject {
  override class func spec(_ aContext: @escaping () -> T) {
    it("should be released from memory") { ... }

class MacrelSpec: QuickSpec {
  override func spec() {
    it(ShouldNotHaveMemoryLeaks.self) { Macrel() }

This is a purely additive feature; this PR doesn't touch any existing behavior.

Copy link

@QuickBot QuickBot commented Jul 22, 2019

1 Warning
⚠️ Big PR

Generated by 🚫 Danger


Copy link

@Robert-Hillary Robert-Hillary commented May 1, 2020

I'm no Quick expert, but I find that the itBehavesLike method limits naming options for Behaviour subclasses and this overload would provide a little more flexibility.


Base automatically changed from master to main Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants