-
Notifications
You must be signed in to change notification settings - Fork 511
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 shared examples. #442
Add shared examples. #442
Conversation
Shared examples allow developers to reuse a set of describe, context, and it nodes to test one or more classes. See the functional tests in `Tests/Shared Examples/KWSharedExampleFunctionalTest.m` for sample usage. Addresses issues kiwi-bdd#175, kiwi-bdd#138. - `KWSharedExampleRegistry` is a singleton that maintains a mapping of shared example names to `KWSharedExample` instances. - `KWSharedExample` is a data structure composed of a name and context block. - `sharedExamplesFor` creates a `KWSharedExample` and registers it. - `itBehavesLike` looks up the `KWSharedExample` with the given name and inserts its context block into the current example group. - `SHARED_EXAMPLES_BEGIN`, `SHARED_EXAMPLES_END` macros are used to ensure `sharedExamplesFor` are evaluated prior to any examples. - In order to assertion macros like `should` could be compiled outside of the implementation block of a `KWSpec`--like within a `sharedExamplesFor`, for example--changed macro to reference global state referenced by `KWSpec` class method. - Changed all pragma marks referencing internal/private methods to `Internal Methods`. - Removed unused `KWEncodingForVoidMethod` function.
…ample Conflicts: Kiwi.xcodeproj/project.pbxproj
Is this good to merge? @supermarin @stepanhruda |
@modocache I know it sucks to hear this, and I'm okay if you don't agree. It would maybe make sense to merge this after we release 2.3 converted to ARC, I've converted almost everything, there's 1 file left (KWMessagePattern) that'll be done tomorrow. |
Not at all! In fact, I agree 100%. I'm of the opinion that we should prioritize refactors over new features like this, anyway. I was just wondering if anybody had seen this in the first place. In any case ping me in this thread once you feel 2.3 has calmed down enough. |
We would love to see support for this as well, any chance this will be merged into master anytime soon? |
@modocache hey sorry - totally forgot on this. As I'm a bit out of happenings recently, what's the state of this PR, is it mergeable? |
@supermarin Assuming I can rebase, it's mergeable, but not very well implemented. The problem is that when a shared example fails, the shared example code is highlighted, not the It's probably possible to highlight the |
@modocache @supermarin I was wondering what happened to this PR. Any reason why it has not been merged yet, 2.3 was released about 8 months ago? i.e. Is it just due to lack of time or are there any breaking issues? |
@ecaselles Lack of time. Feel free to fork, rebase, and re-submit the PR. You could also improve it by fixing the |
@modocache 🙋 I have created PR #600 which basically rebases this PR on top of the current Kiwi version. As part of it, I have also upgraded the tests to run on |
Closed via #600. |
Shared examples allow developers to reuse a set of describe, context,
and it nodes to test one or more classes. See the functional tests in
Tests/Shared Examples/KWSharedExampleFunctionalTest.m
for sampleusage.
Addresses issues #175, #138.
KWSharedExampleRegistry
is a singleton that maintains a mapping ofshared example names to
KWSharedExample
instances.KWSharedExample
is a data structure composed of a name and contextblock.
sharedExamplesFor
creates aKWSharedExample
and registers it.itBehavesLike
looks up theKWSharedExample
with the given name andinserts its context block into the current example group.
SHARED_EXAMPLES_BEGIN
,SHARED_EXAMPLES_END
macros are used toensure
sharedExamplesFor
are evaluated prior to any examples.should
to be compiled outsideof the implementation block of a
KWSpec
--like withinsharedExamplesFor
,for example--changed macro to reference global state by using
KWSpec
class method.Internal Methods
.KWEncodingForVoidMethod
function.Sample Usage
Additional Comments
Feedback very much appreciated! Especially with regards to the following:
CONFIG_START
andCONFIG_END
macros, but they don't seem to be working for me.it
block in thesharedExamplesFor
block, not on the line withitBehavesLike
. I don't know how to make theitBehavesLike
block highlighted. Callsites? 😕