{"action":"created","issue":{"url":"https://api.github.com/repos/Quick/Quick/issues/445","repository_url":"https://api.github.com/repos/Quick/Quick","labels_url":"https://api.github.com/repos/Quick/Quick/issues/445/labels{/name}","comments_url":"https://api.github.com/repos/Quick/Quick/issues/445/comments","events_url":"https://api.github.com/repos/Quick/Quick/issues/445/events","html_url":"https://github.com/Quick/Quick/issues/445","id":122928911,"number":445,"title":"BeforeEach not executing - what am I missing?","user":{"login":"Jtango18","id":801539,"avatar_url":"https://avatars.githubusercontent.com/u/801539?v=3","gravatar_id":"","url":"https://api.github.com/users/Jtango18","html_url":"https://github.com/Jtango18","followers_url":"https://api.github.com/users/Jtango18/followers","following_url":"https://api.github.com/users/Jtango18/following{/other_user}","gists_url":"https://api.github.com/users/Jtango18/gists{/gist_id}","starred_url":"https://api.github.com/users/Jtango18/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jtango18/subscriptions","organizations_url":"https://api.github.com/users/Jtango18/orgs","repos_url":"https://api.github.com/users/Jtango18/repos","events_url":"https://api.github.com/users/Jtango18/events{/privacy}","received_events_url":"https://api.github.com/users/Jtango18/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2015-12-18T11:07:31Z","updated_at":"2016-11-15T07:54:46Z","closed_at":"2015-12-18T15:10:34Z","body":"Hi all,\n\nI'm pretty new to Quick, but I'm having an issue with the most basic of scenarios, hoping someone can point to something very simple I'm doing wrong.\n\nI have the follow spec setup\n\n```\nclass TripSpec : QuickSpec\n{\n    override func spec() {\n        describe(\"a trip\") {\n            var trip: Trip!\n            beforeEach {\n                trip = Trip(tripName: \"Test Trip\", purpose: 0)\n                print(\"Trip Created\")\n            }\n            describe(\"its distance\"){\n                context(\"after adding a segment\"){\n                    let segment = TripSegment(coordinates: [CLLocationCoordinate2D()], distance: 37.5);\n                    trip.addSegment(segment)\n                    it(\"has added distance\") {\n                        expect(trip.distance).to(beCloseTo(37.5, within:0.1));\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\nThe problem I'm having is that the before each doesn't seem to be getting called. When I try to access my variable \"trip\" in the context and in the it statement, it is nil.\n\nAny help would be much appreciated.\n\nCheers\n\nJT\n"},"comment":{"url":"https://api.github.com/repos/Quick/Quick/issues/comments/260572143","html_url":"https://github.com/Quick/Quick/issues/445#issuecomment-260572143","issue_url":"https://api.github.com/repos/Quick/Quick/issues/445","id":260572143,"user":{"login":"jeffh","id":68616,"avatar_url":"https://avatars.githubusercontent.com/u/68616?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffh","html_url":"https://github.com/jeffh","followers_url":"https://api.github.com/users/jeffh/followers","following_url":"https://api.github.com/users/jeffh/following{/other_user}","gists_url":"https://api.github.com/users/jeffh/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffh/subscriptions","organizations_url":"https://api.github.com/users/jeffh/orgs","repos_url":"https://api.github.com/users/jeffh/repos","events_url":"https://api.github.com/users/jeffh/events{/privacy}","received_events_url":"https://api.github.com/users/jeffh/received_events","type":"User","site_admin":false},"created_at":"2016-11-15T07:54:46Z","updated_at":"2016-11-15T07:54:46Z","body":"Hey @vinamelody,\r\n\r\n`beforeEach` only executes if there's an `it` block associated with it to run with.\r\n\r\n```swift\r\nclass CurrencyTest: QuickSpec {\r\n\r\n    override func spec() {\r\n\r\n        describe(\"Valid Currency\") {\r\n\r\n            beforeEach {\r\n                print(\"This is beforeEach in QuickSpec\")\r\n            }\r\n            print(\"Valid Currency is called here.\")\r\n\r\n            //\r\n            // This line below will cause beforeEaches to fire\r\n            //\r\n            it(\"does something\") { }\r\n        }\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"jeffh"}}