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

Open
wants to merge 2 commits into
base: master
from

Conversation

@VojtaStavik
Copy link

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.

Example:

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.

@QuickBot

This comment has been minimized.

Copy link

commented Jul 22, 2019

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.