Quick: it should receive example metadata

Created on 29 Sep 2014  ·  18Comments  ·  Source: Quick/Quick

In it calls, the closure should (optionally) receive example metadata in the same way that beforeEach does.

I don't see this being a contentious API change, and is non-breaking, so I'm going to begin work on it and get back to you with a PR for feedback.

enhancement discussion feature

All 18 comments

Basically what I'm trying to avoid is writing code like this:

describe("in some context") {
    var metadata: ExampleMetadata?
    beforeEach(closure: { (exampleMetadata) -> () in
        metadata = exampleMetadata
    })

    it("has valid snapshot") {
        /* access metadata */
    }
...

And instead write the following:

describe("in some context") {    
    it("doesn't care about metadata") {
        ...
    }
    it("has valid snapshot") { (exampleMetadata) -> () in
        /* access exampleMetadata */
    }
...

Totally agree. Make sure to check out the metadata being passed to before/after blocks, and use those in your PR if you can (or change them as need be to make that possible).

Also, take a look at how RSpec does it--can't go wrong copying their approach.

Bonus points if you also port the functionality to Objective-C! :100:

I will do my best.

@modocache What are your thoughts on automatically supplying this information to matchers, too?

Not to put things off but weren't we suppose to try and build a reporter infrastructure instead of encouraging using this more temporary metadata feature?

I really have no horse in this race – I just want to be able to fix https://github.com/AshFurrow/Nimble-Snapshots/issues/6 . It's totally possible to have a long-term plan of having a reporter infrastructure but for now I'd rather get working software.

@jeffh I think custom reporters are necessary to customize the output when you run xcodebuild (see issue #9). Example metadata is useful for the same reasons RSpec uses it. So as far as I've thought about it, I don't perceive there to be a feature overlap here. Let me know if you think differently.

Also, GitHub email response formatting ain't great. In case you missed it, @AshFurrow, this was my entire comment from earlier:

Totally agree. Make sure to check out the metadata being passed to before/after blocks, and use those in your PR if you can (or change them as need be to make that possible).

Also, take a look at how RSpec does it--can't go wrong copying their approach.

Bonus points if you also port the functionality to Objective-C! :100:

I haven't had the time to think about metadata and matchers yet, sorry--I'll comment here again later once I've given it some thought.

I'm sorry if I sounded too strong-willed. The first argument could also be used for async callback completion (eg - jasmine, mocha, gingko), which seems more generally useful than example metadata. But if we're not honoring any public API contracts right now I'm fine with it.

For the record, I still think this is worth doing--I just keep putting it on the back burner... :no_mouth:

It happens – don't let it get you down!

What's the status on this @ashfurrow? :)

We were able to fix my issue without this, so it fell off my radar. I can take a look at making a PR after Labour Day.

Bringing attention back to this issue since it's after Labour Day. 🐱 @ashfurrow Do you have more free time these days?

I regret to say that I haven't had time to look at this, and likely won't until the holidays. I'll remove myself as an assignee in case someone else wants to tackle it, but I'll put a calendar reminder to look at it over xmas 👍

No problem. Thanks!

I know I'm a little late (not xmas) but just in case you're looking for something to do during the holiday/new years season, @ashfurrow. :D No worries if not though.

I'm afraid I never got to this, my schedule is pretty busy coming up so I don't think I'll be able to tackle it in the near future.

Was this page helpful?
0 / 5 - 0 ratings