{"action":"created","issue":{"url":"https://api.github.com/repos/kiwi-bdd/Kiwi/issues/600","labels_url":"https://api.github.com/repos/kiwi-bdd/Kiwi/issues/600/labels{/name}","comments_url":"https://api.github.com/repos/kiwi-bdd/Kiwi/issues/600/comments","events_url":"https://api.github.com/repos/kiwi-bdd/Kiwi/issues/600/events","html_url":"https://github.com/kiwi-bdd/Kiwi/pull/600","id":62442374,"number":600,"title":"Adds shared examples to Kiwi.","user":{"login":"ecaselles","id":7735546,"avatar_url":"https://avatars.githubusercontent.com/u/7735546?v=3","gravatar_id":"","url":"https://api.github.com/users/ecaselles","html_url":"https://github.com/ecaselles","followers_url":"https://api.github.com/users/ecaselles/followers","following_url":"https://api.github.com/users/ecaselles/following{/other_user}","gists_url":"https://api.github.com/users/ecaselles/gists{/gist_id}","starred_url":"https://api.github.com/users/ecaselles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ecaselles/subscriptions","organizations_url":"https://api.github.com/users/ecaselles/orgs","repos_url":"https://api.github.com/users/ecaselles/repos","events_url":"https://api.github.com/users/ecaselles/events{/privacy}","received_events_url":"https://api.github.com/users/ecaselles/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-17T16:12:13Z","updated_at":"2015-03-18T20:48:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kiwi-bdd/Kiwi/pulls/600","html_url":"https://github.com/kiwi-bdd/Kiwi/pull/600","diff_url":"https://github.com/kiwi-bdd/Kiwi/pull/600.diff","patch_url":"https://github.com/kiwi-bdd/Kiwi/pull/600.patch"},"body":"This PR adds shared examples to the latest version of ```Kiwi``` ([2.3.1](https://github.com/kiwi-bdd/Kiwi/releases/tag/2.3.1)) as implemented by @modocache in #442.\r\n\r\nShared 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.\r\n\r\nAddresses issues #175, #138.\r\n\r\n## Implementation Details\r\n- ```KWSharedExampleRegistry``` is a singleton that maintains a mapping of shared example names to ```KWSharedExample``` instances.\r\n- ```KWSharedExample``` is a data structure composed of a name and context block.\r\n- ```sharedExamplesFor``` creates a ```KWSharedExample``` and registers it.\r\n- ```itBehavesLike``` looks up the ```KWSharedExample``` with the given name and inserts its context block into the current example group.\r\n- ```SHARED_EXAMPLES_BEGIN```, ```SHARED_EXAMPLES_END``` macros are used to ensure ```sharedExamplesFor``` are evaluated prior to any examples.\r\n- In order to allow assertion macros like should to be compiled outside of the implementation block of a ```KWSpec```--like within ```sharedExamplesFor```, for example--changed macro to reference global state by using ```KWSpec``` class method.\r\n- Changed all pragma marks referencing internal/private methods to Internal Methods.\r\n- Removed unused ```KWEncodingForVoidMethod``` function.\r\n\r\n## Sample Usage\r\n```Obj-C\r\n// CruiserSpecHelpers.m\r\n\r\nSHARED_EXAMPLES_BEGIN(CruiserSpecHelpers)\r\n\r\nsharedExamplesFor(@\"a cruiser\", ^(Class describedClass) {\r\n    __block Cruiser *cruiser = nil;\r\n    beforeEach(^{\r\n        cruiser = [[describedClass alloc] initWithCallsign:@\"Planet Express\"];\r\n    });\r\n\r\n    it(@\"has a callsign\", ^{\r\n        [[cruiser.callsign should] equal:@\"Planet Express\"];\r\n    });\r\n});\r\n\r\nSHARED_EXAMPLES_END\r\n```\r\n\r\n```Obj-C\r\n// CruiserSpec.m\r\n\r\nSPEC_BEGIN(CruiserSpec)\r\n\r\ndescribe(@\"Cruiser\", ^{\r\n    itBehavesLike(@\"a cruiser\", [Cruiser class]);\r\n});\r\n\r\ndescribe(@\"Carrier\", ^{\r\n    itBehavesLike(@\"a cruiser\", [Carrier class]);\r\n});\r\n\r\nSPEC_END\r\n```\r\n\r\n## Additional Information\r\n\r\nFor more information you can visit the original PR #442."},"comment":{"url":"https://api.github.com/repos/kiwi-bdd/Kiwi/issues/comments/83165610","html_url":"https://github.com/kiwi-bdd/Kiwi/pull/600#issuecomment-83165610","issue_url":"https://api.github.com/repos/kiwi-bdd/Kiwi/issues/600","id":83165610,"user":{"login":"modocache","id":552921,"avatar_url":"https://avatars.githubusercontent.com/u/552921?v=3","gravatar_id":"","url":"https://api.github.com/users/modocache","html_url":"https://github.com/modocache","followers_url":"https://api.github.com/users/modocache/followers","following_url":"https://api.github.com/users/modocache/following{/other_user}","gists_url":"https://api.github.com/users/modocache/gists{/gist_id}","starred_url":"https://api.github.com/users/modocache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modocache/subscriptions","organizations_url":"https://api.github.com/users/modocache/orgs","repos_url":"https://api.github.com/users/modocache/repos","events_url":"https://api.github.com/users/modocache/events{/privacy}","received_events_url":"https://api.github.com/users/modocache/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T20:48:24Z","updated_at":"2015-03-18T20:48:24Z","body":"I'll defer to @sharplet, since he's more familiar with modern-day Kiwi, but I'm excited to see this released!!\r\n\r\nWhen a failure occurs, are the correct lines highlighted in Xcode?"}}