8000 Expose current spec for XCTest expectations by pcantrell · Pull Request #645 · Quick/Quick · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Expose current spec for XCTest expectations #645

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

Merged
merged 5 commits into from
Oct 19, 2017

Conversation

pcantrell
Copy link
Contributor
@pcantrell pcantrell commented Nov 29, 2016

This provides a static QuickSpec.current() method which allows specs to get a reference to the currently executing QuickSpec, which is essential for using XCTest expectations.

This is an updated version of #331. It fixes #330 and #578.

There was a lot of high-minded discussion back then about different approaches to this problem, and indecision lead to nothing happening. This PR is an attempt to nudge Quick toward resolving the issue. Two arguments in favor of this solution:

  • It’s simple.
  • It works. Siesta has happily been using this on a fork for over a year.

If the Quick team is willing to accept this change, I’m happy to add tests and/or docs to the PR. Let me know.

  • Tests
  • Docs
  • Breaks API: no
  • New feature: yes

@istx25
Copy link
istx25 commented Dec 12, 2016

Thanks for filing this PR, @pcantrell. I'm down for the change. Would you be able to prepare tests and docs for this change?

@jeffh
Copy link
Member
jeffh commented Dec 13, 2016

I'm fine with the change with tests and docs 👍

@istx25
Copy link
istx25 commented Dec 31, 2016

@pcantrell: Would you be able to make tests and docs for this PR?

@pcantrell pcantrell force-pushed the expose-current-spec-swift3 branch from 1c2c405 to f9032fe Compare April 25, 2017 17:56
it("returns nil when no spec is executing") {
expect(currentSpecDuringSpecSetup).to(beNil())
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@pcantrell
Copy link
Contributor Author
pcantrell commented Apr 25, 2017

I’ve added tests and docs.

I also made QuickSpec.current a property instead of a method, since class properties are a thing we can do in Obj-C now.

The user docs I wrote are entirely centered around XCTest expectations, since they’re the common use case for this. Let me know if what I wrote suits you.

@QuickBot
Copy link
QuickBot commented Apr 25, 2017
1 Warning
⚠️ Big PR

Generated by 🚫 danger

@freak4pc
Copy link
Contributor

IS there any progress being made on this PR? I was also googling around to understand how do i "fulfill" an expectation with Quick.

@pcantrell
Copy link
Contributor Author

@freak4pc It’s waiting for review. I just synced with the main branch, so it’s all ready for a merge if the core team likes it.

@marcelofabri
Copy link
Contributor

Any chance to get this merged?

RamwiseMatt pushed a commit to RamwiseMatt/Quick that referenced this pull request Sep 5, 2017
@pcantrell pcantrell force-pushed the expose-current-spec-swift3 branch from bd0b798 to ea7d540 Compare September 14, 2017 15:37
@pcantrell
Copy link
Contributor Author

I’ve rebased this against master, and it should once again be ready to merge pending CI.

(I’m not sure why it’s tagged github-review-needs-revision. AFAIK, there are no pending changes, either from this discussion thread or the CI bots.)

@marcelofabri
Copy link
Contributor

I'd love to see this merged, as it's a blocker for #680, which would make using Quick + Nimble much easier when dealing with throws.

@modocache
Copy link
Member

This looks fantastic, thanks! 😍 Sorry it took me a while to get to review and merge 😢

@modocache modocache merged commit ce790c5 into Quick:master Oct 19, 2017
@freak4pc
Copy link
Contributor
freak4pc commented Oct 19, 2017

Woohoo! Congrats @pcantrell !

P.S @modocache I'm not so involved in Quick so just wondering, how quickly (pun intended) does a new version get cut from master ?

@pcantrell
Copy link
Contributor Author

Thanks for getting this in!

@Satchitananda
Copy link

What about the state of thecurrent property?

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

Successfully merging this pull request may close these issues.

XCTestExpectation fulfill() in Quick test causes NSInternalInconsistencyException
9 participants
0