{"action":"created","comment":{"url":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/comments/35889609","id":35889609,"diff_hunk":"@@ -1,48 +1,93 @@\n require 'airport'\n \n-## Note these are just some guidelines!\n-## Feel free to write more tests!!\n+describe Airport do\n \n-# A plane currently in the airport can be requested to take off.\n-#\n-# No more planes can be added to the airport, if it's full.\n-# It is up to you how many planes can land in the airport\n-# and how that is implemented.\n-#\n-# If the airport is full then no planes can land\n+  let(:plane){double :plane}\n \n-describe Airport do\n+  describe 'ariving' do\n+    it 'instructs a plane to land' do\n+      expect(subject).to respond_to :ariving\n+    end\n+\n+    it 'receives a plane' do\n+      allow(subject).to receive(:set_weather){\"Sunny\"}\n+      allow(plane).to receive(:land)\n+\n+      subject.ariving(plane)\n+      expect(subject.planes).to_not eq []\n+    end\n \n-  describe 'take off' do\n-    xit 'instructs a plane to take off'\n+    it \"plane should land on arival\" do\n+      allow(subject).to receive(:set_weather){\"Sunny\"}\n \n-    xit 'releases a plane'\n+      plane = spy :plane\n+      subject.ariving(plane)\n+      expect(plane).to have_received(:land)\n+      # This is only testing if it recieves method .land the outcome doesn't matter as that is a problem for the plane spec.\n+    end\n   end\n \n-  describe 'landing' do\n-    xit 'instructs a plane to land'\n+  describe 'leaving' do\n+    it 'instructs a plane to take off' do\n+      expect(subject).to respond_to :leaving\n+    end\n+\n+    it 'releases a plane' do\n+      allow(subject).to receive(:set_weather){\"Sunny\"}\n+      allow(plane).to receive(:land)\n+      allow(plane).to receive(:take_off)\n+\n+      subject.ariving(plane)\n+      subject.leaving(plane)\n+      expect(subject.planes).to eq []\n+    end\n+\n+    it \"plane should take off on leaving\" do\n+      allow(subject).to receive(:set_weather){\"Sunny\"}\n+\n+      plane = spy :plane\n+      subject.ariving(plane)\n+      subject.leaving(plane)\n+      expect(plane).to have_received(:take_off)\n+      # This is the same as testing the .land, outcome doesn't matter.\n+    end\n+\n+    it \"shouldn't let out planes that aren't in the airport\" do\n+      allow(subject).to receive(:set_weather){\"Sunny\"}\n+      expect{subject.leaving(plane)}.to raise_error \"The plane is not at this airport\"\n+    end\n \n-    xit 'receives a plane'\n   end\n \n-  describe 'traffic control' do\n+  context 'traffic control' do\n     context 'when airport is full' do\n-      xit 'does not allow a plane to land'\n-    end\n+      it 'does not allow a plane to land' do\n+        allow(subject).to receive(:set_weather){\"Sunny\"}\n+        allow(plane).to receive(:land)\n \n-    # Include a weather condition.\n-    # The weather must be random and only have two states \"sunny\" or \"stormy\".\n-    # Try and take off a plane, but if the weather is stormy,\n-    # the plane can not take off and must remain in the airport.\n-    #\n-    # This will require stubbing to stop the random return of the weather.\n-    # If the airport has a weather condition of stormy,\n-    # the plane can not land, and must not be in the airport\n+        subject.capacity.times {subject.ariving(plane)}\n+        expect{subject.ariving(plane)}.to raise_error \"Cannot land, airport full\"\n+      end \n+    end\n \n     context 'when weather conditions are stormy' do\n-      xit 'does not allow a plane to take off'\n+      \n+      it 'does not allow a plane to take off' do\n+        allow(subject).to receive(:set_weather){\"Sunny\"}\n+        allow(plane).to receive(:land)\n+\n+        subject.ariving(plane)\n+\n+        allow(subject).to receive(:set_weather){\"Stormy\"}","path":"spec/airport_spec.rb","position":109,"original_position":109,"commit_id":"22d06c8374ee23c70a0da29baf376cb92cf3aed6","original_commit_id":"22d06c8374ee23c70a0da29baf376cb92cf3aed6","user":{"login":"sjmog","id":1960230,"avatar_url":"https://avatars.githubusercontent.com/u/1960230?v=3","gravatar_id":"","url":"https://api.github.com/users/sjmog","html_url":"https://github.com/sjmog","followers_url":"https://api.github.com/users/sjmog/followers","following_url":"https://api.github.com/users/sjmog/following{/other_user}","gists_url":"https://api.github.com/users/sjmog/gists{/gist_id}","starred_url":"https://api.github.com/users/sjmog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjmog/subscriptions","organizations_url":"https://api.github.com/users/sjmog/orgs","repos_url":"https://api.github.com/users/sjmog/repos","events_url":"https://api.github.com/users/sjmog/events{/privacy}","received_events_url":"https://api.github.com/users/sjmog/received_events","type":"User","site_admin":false},"body":"If you're using string conditions like `\"Stormy\"` or `\"Sunny\"`, prefer to use symbols over strings.\r\n\r\nSymbols are immutable, they're tidier, they're fast, they're neat: `:sunny` `:stormy`","created_at":"2015-07-30T16:24:17Z","updated_at":"2015-07-30T16:24:17Z","html_url":"https://github.com/makersacademy/airport_challenge/pull/128#discussion_r35889609","pull_request_url":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128","_links":{"self":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/comments/35889609"},"html":{"href":"https://github.com/makersacademy/airport_challenge/pull/128#discussion_r35889609"},"pull_request":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128"}}},"pull_request":{"url":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128","id":40877384,"html_url":"https://github.com/makersacademy/airport_challenge/pull/128","diff_url":"https://github.com/makersacademy/airport_challenge/pull/128.diff","patch_url":"https://github.com/makersacademy/airport_challenge/pull/128.patch","issue_url":"https://api.github.com/repos/makersacademy/airport_challenge/issues/128","number":128,"state":"open","locked":false,"title":"Josh Tatterton completed challenge","user":{"login":"JoshuaTatterton","id":12698877,"avatar_url":"https://avatars.githubusercontent.com/u/12698877?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaTatterton","html_url":"https://github.com/JoshuaTatterton","followers_url":"https://api.github.com/users/JoshuaTatterton/followers","following_url":"https://api.github.com/users/JoshuaTatterton/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaTatterton/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaTatterton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaTatterton/subscriptions","organizations_url":"https://api.github.com/users/JoshuaTatterton/orgs","repos_url":"https://api.github.com/users/JoshuaTatterton/repos","events_url":"https://api.github.com/users/JoshuaTatterton/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaTatterton/received_events","type":"User","site_admin":false},"body":"I've completed the challenge, just writing this to submit it","created_at":"2015-07-27T07:43:57Z","updated_at":"2015-07-30T16:24:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e90e1a25e6d7c703e6c367d771dca674964a81d2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128/commits","review_comments_url":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128/comments","review_comment_url":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/comments{/number}","comments_url":"https://api.github.com/repos/makersacademy/airport_challenge/issues/128/comments","statuses_url":"https://api.github.com/repos/makersacademy/airport_challenge/statuses/22d06c8374ee23c70a0da29baf376cb92cf3aed6","head":{"label":"JoshuaTatterton:master","ref":"master","sha":"22d06c8374ee23c70a0da29baf376cb92cf3aed6","user":{"login":"JoshuaTatterton","id":12698877,"avatar_url":"https://avatars.githubusercontent.com/u/12698877?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaTatterton","html_url":"https://github.com/JoshuaTatterton","followers_url":"https://api.github.com/users/JoshuaTatterton/followers","following_url":"https://api.github.com/users/JoshuaTatterton/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaTatterton/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaTatterton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaTatterton/subscriptions","organizations_url":"https://api.github.com/users/JoshuaTatterton/orgs","repos_url":"https://api.github.com/users/JoshuaTatterton/repos","events_url":"https://api.github.com/users/JoshuaTatterton/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaTatterton/received_events","type":"User","site_admin":false},"repo":{"id":39645155,"name":"airport_challenge","full_name":"JoshuaTatterton/airport_challenge","owner":{"login":"JoshuaTatterton","id":12698877,"avatar_url":"https://avatars.githubusercontent.com/u/12698877?v=3","gravatar_id":"","url":"https://api.github.com/users/JoshuaTatterton","html_url":"https://github.com/JoshuaTatterton","followers_url":"https://api.github.com/users/JoshuaTatterton/followers","following_url":"https://api.github.com/users/JoshuaTatterton/following{/other_user}","gists_url":"https://api.github.com/users/JoshuaTatterton/gists{/gist_id}","starred_url":"https://api.github.com/users/JoshuaTatterton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoshuaTatterton/subscriptions","organizations_url":"https://api.github.com/users/JoshuaTatterton/orgs","repos_url":"https://api.github.com/users/JoshuaTatterton/repos","events_url":"https://api.github.com/users/JoshuaTatterton/events{/privacy}","received_events_url":"https://api.github.com/users/JoshuaTatterton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JoshuaTatterton/airport_challenge","description":"Fly!","fork":true,"url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge","forks_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/forks","keys_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/teams","hooks_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/hooks","issue_events_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/issues/events{/number}","events_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/events","assignees_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/assignees{/user}","branches_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/branches{/branch}","tags_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/tags","blobs_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/git/refs{/sha}","trees_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/statuses/{sha}","languages_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/languages","stargazers_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/stargazers","contributors_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/contributors","subscribers_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/subscribers","subscription_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/subscription","commits_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/commits{/sha}","git_commits_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/git/commits{/sha}","comments_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/comments{/number}","issue_comment_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/issues/comments{/number}","contents_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/contents/{+path}","compare_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/merges","archive_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/downloads","issues_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/issues{/number}","pulls_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/pulls{/number}","milestones_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/milestones{/number}","notifications_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/labels{/name}","releases_url":"https://api.github.com/repos/JoshuaTatterton/airport_challenge/releases{/id}","created_at":"2015-07-24T16:33:26Z","updated_at":"2015-07-24T16:33:28Z","pushed_at":"2015-07-27T07:42:00Z","git_url":"git://github.com/JoshuaTatterton/airport_challenge.git","ssh_url":"git@github.com:JoshuaTatterton/airport_challenge.git","clone_url":"https://github.com/JoshuaTatterton/airport_challenge.git","svn_url":"https://github.com/JoshuaTatterton/airport_challenge","homepage":"","size":140,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"makersacademy:master","ref":"master","sha":"bc7464938497f58404dc4037ecc5806d399ad517","user":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"repo":{"id":27074983,"name":"airport_challenge","full_name":"makersacademy/airport_challenge","owner":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/makersacademy/airport_challenge","description":"Fly!","fork":false,"url":"https://api.github.com/repos/makersacademy/airport_challenge","forks_url":"https://api.github.com/repos/makersacademy/airport_challenge/forks","keys_url":"https://api.github.com/repos/makersacademy/airport_challenge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/makersacademy/airport_challenge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/makersacademy/airport_challenge/teams","hooks_url":"https://api.github.com/repos/makersacademy/airport_challenge/hooks","issue_events_url":"https://api.github.com/repos/makersacademy/airport_challenge/issues/events{/number}","events_url":"https://api.github.com/repos/makersacademy/airport_challenge/events","assignees_url":"https://api.github.com/repos/makersacademy/airport_challenge/assignees{/user}","branches_url":"https://api.github.com/repos/makersacademy/airport_challenge/branches{/branch}","tags_url":"https://api.github.com/repos/makersacademy/airport_challenge/tags","blobs_url":"https://api.github.com/repos/makersacademy/airport_challenge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/makersacademy/airport_challenge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/makersacademy/airport_challenge/git/refs{/sha}","trees_url":"https://api.github.com/repos/makersacademy/airport_challenge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/makersacademy/airport_challenge/statuses/{sha}","languages_url":"https://api.github.com/repos/makersacademy/airport_challenge/languages","stargazers_url":"https://api.github.com/repos/makersacademy/airport_challenge/stargazers","contributors_url":"https://api.github.com/repos/makersacademy/airport_challenge/contributors","subscribers_url":"https://api.github.com/repos/makersacademy/airport_challenge/subscribers","subscription_url":"https://api.github.com/repos/makersacademy/airport_challenge/subscription","commits_url":"https://api.github.com/repos/makersacademy/airport_challenge/commits{/sha}","git_commits_url":"https://api.github.com/repos/makersacademy/airport_challenge/git/commits{/sha}","comments_url":"https://api.github.com/repos/makersacademy/airport_challenge/comments{/number}","issue_comment_url":"https://api.github.com/repos/makersacademy/airport_challenge/issues/comments{/number}","contents_url":"https://api.github.com/repos/makersacademy/airport_challenge/contents/{+path}","compare_url":"https://api.github.com/repos/makersacademy/airport_challenge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/makersacademy/airport_challenge/merges","archive_url":"https://api.github.com/repos/makersacademy/airport_challenge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/makersacademy/airport_challenge/downloads","issues_url":"https://api.github.com/repos/makersacademy/airport_challenge/issues{/number}","pulls_url":"https://api.github.com/repos/makersacademy/airport_challenge/pulls{/number}","milestones_url":"https://api.github.com/repos/makersacademy/airport_challenge/milestones{/number}","notifications_url":"https://api.github.com/repos/makersacademy/airport_challenge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/makersacademy/airport_challenge/labels{/name}","releases_url":"https://api.github.com/repos/makersacademy/airport_challenge/releases{/id}","created_at":"2014-11-24T12:30:39Z","updated_at":"2015-06-13T06:36:50Z","pushed_at":"2015-07-29T20:17:36Z","git_url":"git://github.com/makersacademy/airport_challenge.git","ssh_url":"git@github.com:makersacademy/airport_challenge.git","clone_url":"https://github.com/makersacademy/airport_challenge.git","svn_url":"https://github.com/makersacademy/airport_challenge","homepage":"","size":3789,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":112,"mirror_url":null,"open_issues_count":19,"forks":112,"open_issues":19,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128"},"html":{"href":"https://github.com/makersacademy/airport_challenge/pull/128"},"issue":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/issues/128"},"comments":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/issues/128/comments"},"review_comments":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128/comments"},"review_comment":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/pulls/128/commits"},"statuses":{"href":"https://api.github.com/repos/makersacademy/airport_challenge/statuses/22d06c8374ee23c70a0da29baf376cb92cf3aed6"}}}}