{"action":"created","issue":{"url":"https://api.github.com/repos/nestorsalceda/mamba/issues/113","repository_url":"https://api.github.com/repos/nestorsalceda/mamba","labels_url":"https://api.github.com/repos/nestorsalceda/mamba/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/nestorsalceda/mamba/issues/113/comments","events_url":"https://api.github.com/repos/nestorsalceda/mamba/issues/113/events","html_url":"https://github.com/nestorsalceda/mamba/pull/113","id":327140897,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxMDEyNzgx","number":113,"title":"Shared contexts","user":{"login":"DerTraveler","id":6623784,"node_id":"MDQ6VXNlcjY2MjM3ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6623784?v=4","gravatar_id":"","url":"https://api.github.com/users/DerTraveler","html_url":"https://github.com/DerTraveler","followers_url":"https://api.github.com/users/DerTraveler/followers","following_url":"https://api.github.com/users/DerTraveler/following{/other_user}","gists_url":"https://api.github.com/users/DerTraveler/gists{/gist_id}","starred_url":"https://api.github.com/users/DerTraveler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DerTraveler/subscriptions","organizations_url":"https://api.github.com/users/DerTraveler/orgs","repos_url":"https://api.github.com/users/DerTraveler/repos","events_url":"https://api.github.com/users/DerTraveler/events{/privacy}","received_events_url":"https://api.github.com/users/DerTraveler/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-29T01:04:28Z","updated_at":"2018-06-11T08:57:19Z","closed_at":"2018-06-11T08:57:06Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/nestorsalceda/mamba/pulls/113","html_url":"https://github.com/nestorsalceda/mamba/pull/113","diff_url":"https://github.com/nestorsalceda/mamba/pull/113.diff","patch_url":"https://github.com/nestorsalceda/mamba/pull/113.patch"},"body":"I added two new example group contexts `shared_context` and `included_context`.\r\n\r\nAny `shared_context` will not be executed on its own but will be inserted in any place where you use the context `included_context` **with the same description** . \r\n\r\nExample:\r\n```python\r\nwith shared_context('Request tests'):\r\n    with context('When the request succeeds'):\r\n        with before.each:\r\n            # Mocking success\r\n        with it('returns HTTP Status Code 200'):\r\n            ...\r\n    with context('When the request fails'):\r\n        ...\r\n\r\nwith describe('GET /api/important_data'):\r\n    with before.all:\r\n        # Some endpoint-specific preparations\r\n    with included_context('Request tests'):\r\n        pass\r\n\r\nwith describe('POST /api/dangerous'):\r\n     with before.all:\r\n        # Some endpoint-specific preparations\r\n     with included_context('Request tests'):\r\n        with it('additional security test'):\r\n            pass\r\n```\r\n\r\nAs demonstrated by the (maybe too simple?) tests, any examples defined inside the `included_context` will be added to those of the inserted shared context.\r\n\r\nI didn't add any special support for several hooks or anything, since it shouldn't be necessary... with the current architecture of mamba, any hook defined inside `included_context` will take precedence over any hook defined in the inserted `shared_context`.\r\nIf you want to combine hooks of the same kind (two `before.each`, two `after.all`), you can just wrap the included context in another context that defines the additional hooks.\r\n\r\n\r\nThis will resolve Issue #90 (which I submitted myself some months ago)"},"comment":{"url":"https://api.github.com/repos/nestorsalceda/mamba/issues/comments/396171793","html_url":"https://github.com/nestorsalceda/mamba/pull/113#issuecomment-396171793","issue_url":"https://api.github.com/repos/nestorsalceda/mamba/issues/113","id":396171793,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjE3MTc5Mw==","user":{"login":"nestorsalceda","id":310141,"node_id":"MDQ6VXNlcjMxMDE0MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/310141?v=4","gravatar_id":"","url":"https://api.github.com/users/nestorsalceda","html_url":"https://github.com/nestorsalceda","followers_url":"https://api.github.com/users/nestorsalceda/followers","following_url":"https://api.github.com/users/nestorsalceda/following{/other_user}","gists_url":"https://api.github.com/users/nestorsalceda/gists{/gist_id}","starred_url":"https://api.github.com/users/nestorsalceda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nestorsalceda/subscriptions","organizations_url":"https://api.github.com/users/nestorsalceda/orgs","repos_url":"https://api.github.com/users/nestorsalceda/repos","events_url":"https://api.github.com/users/nestorsalceda/events{/privacy}","received_events_url":"https://api.github.com/users/nestorsalceda/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T08:57:19Z","updated_at":"2018-06-11T08:57:19Z","author_association":"OWNER","body":"It's merged! Thanks :metal: "}}
{"actor":{"display_login":"nestorsalceda"}}