{"action":"created","comment":{"url":"https://api.github.com/repos/eagleas/nglearn/pulls/comments/48118745","id":48118745,"diff_hunk":"@@ -0,0 +1,125 @@\n+\n+describe('ToursController', function(){\n+\n+  beforeEach(module('tnTour'));\n+\n+  var $scope = {};\n+  var Country, Place, Hotel, Tour;\n+  var $controller, $httpBackend, apiDataHelper;\n+  var countryApiUrl = 'https://api.parse.com/1/classes/Country';\n+  var placeApiUrl = 'https://api.parse.com/1/classes/Place/?include=country';\n+  var hotelApiUrl = 'https://api.parse.com/1/classes/Hotel';\n+  var tourApiUrl = 'https://api.parse.com/1/classes/Tour/?include=country,place,hotel';\n+\n+  beforeEach(inject(function(_$controller_, _$httpBackend_, _apiDataHelper_,\n+    _Tour_, _Country_, _Place_, _Hotel_){\n+    Country = _Country_;\n+    Place = _Place_;\n+    Hotel = _Hotel_;\n+    Tour = _Tour_;\n+    $controller = _$controller_;\n+    $httpBackend = _$httpBackend_;\n+    apiDataHelper = _apiDataHelper_;\n+  }));\n+\n+  function makeController(){\n+    $controller('ToursController', {$scope: $scope});\n+  };\n+\n+  function makeTour(){\n+    return {\n+      title: 'A tour',\n+      editMode: false,\n+      country: { objectId: 'a' },\n+      place: { objectId: 'a' },\n+      hotel: { objectId: 'a' },\n+    };\n+  };\n+\n+  describe('initialize', function(){\n+    it('calls query on related services', function(){\n+      spyOn(Country, 'query');\n+      spyOn(Place, 'query');\n+      spyOn(Hotel, 'query');\n+      spyOn(Tour, 'query');\n+      makeController();\n+      expect(Country.query).toHaveBeenCalled();\n+      expect(Place.query).toHaveBeenCalled();\n+      expect(Hotel.query).toHaveBeenCalled();\n+      expect(Tour.query).toHaveBeenCalled();\n+    })\n+  });\n+\n+  describe('controller functions', function(){\n+\n+    beforeEach(function(){\n+      makeController();\n+    });\n+\n+    it('showForm', function(){\n+      expect($scope.hiddenForm).toBe(true);\n+      $scope.showForm();\n+      expect($scope.hiddenForm).toBe(false);\n+      expect($scope.newTour.title).toBe(null);\n+    });\n+\n+    it('hideForm', function(){\n+      $scope.hiddenForm = false;\n+      $scope.hideForm();\n+      expect($scope.hiddenForm).toBe(true);\n+    });\n+\n+    it('editTour', function(){\n+      var tour_template = makeTour();\n+      var tour = angular.copy(tour_template);\n+      $scope.editTour(tour);\n+      expect(tour.draft).toEqual(tour_template);\n+      expect(tour.editMode).toBe(true);\n+    });\n+\n+    it('cancelEdit', function(){\n+      var tour = makeTour();\n+      tour.editMode = true;\n+      $scope.cancelEdit(tour);\n+      expect(tour.editMode).toBe(false);\n+    });\n+\n+    it('saveTour call to Parse.com', function(){\n+      var tour = makeTour();\n+      spyOn(apiDataHelper, 'createPointer').and.callFake(function(obj){return obj});","path":"test/tours_controller.spec.js","position":89,"original_position":89,"commit_id":"0178220cf006ece77bc9defee9a9a760eaafec00","original_commit_id":"0178220cf006ece77bc9defee9a9a760eaafec00","user":{"login":"anaumov","id":1510570,"avatar_url":"https://avatars.githubusercontent.com/u/1510570?v=3","gravatar_id":"","url":"https://api.github.com/users/anaumov","html_url":"https://github.com/anaumov","followers_url":"https://api.github.com/users/anaumov/followers","following_url":"https://api.github.com/users/anaumov/following{/other_user}","gists_url":"https://api.github.com/users/anaumov/gists{/gist_id}","starred_url":"https://api.github.com/users/anaumov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anaumov/subscriptions","organizations_url":"https://api.github.com/users/anaumov/orgs","repos_url":"https://api.github.com/users/anaumov/repos","events_url":"https://api.github.com/users/anaumov/events{/privacy}","received_events_url":"https://api.github.com/users/anaumov/received_events","type":"User","site_admin":false},"body":"callFake тут лишний","created_at":"2015-12-21T05:55:04Z","updated_at":"2015-12-21T05:55:04Z","html_url":"https://github.com/eagleas/nglearn/pull/5#discussion_r48118745","pull_request_url":"https://api.github.com/repos/eagleas/nglearn/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/eagleas/nglearn/pulls/comments/48118745"},"html":{"href":"https://github.com/eagleas/nglearn/pull/5#discussion_r48118745"},"pull_request":{"href":"https://api.github.com/repos/eagleas/nglearn/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/eagleas/nglearn/pulls/5","id":54198812,"html_url":"https://github.com/eagleas/nglearn/pull/5","diff_url":"https://github.com/eagleas/nglearn/pull/5.diff","patch_url":"https://github.com/eagleas/nglearn/pull/5.patch","issue_url":"https://api.github.com/repos/eagleas/nglearn/issues/5","number":5,"state":"open","locked":false,"title":"Задание 5","user":{"login":"eagleas","id":9677,"avatar_url":"https://avatars.githubusercontent.com/u/9677?v=3","gravatar_id":"","url":"https://api.github.com/users/eagleas","html_url":"https://github.com/eagleas","followers_url":"https://api.github.com/users/eagleas/followers","following_url":"https://api.github.com/users/eagleas/following{/other_user}","gists_url":"https://api.github.com/users/eagleas/gists{/gist_id}","starred_url":"https://api.github.com/users/eagleas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eagleas/subscriptions","organizations_url":"https://api.github.com/users/eagleas/orgs","repos_url":"https://api.github.com/users/eagleas/repos","events_url":"https://api.github.com/users/eagleas/events{/privacy}","received_events_url":"https://api.github.com/users/eagleas/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-20T12:48:02Z","updated_at":"2015-12-21T05:55:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bf368d30122ec51d32ceea2776054a27576b70f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eagleas/nglearn/pulls/5/commits","review_comments_url":"https://api.github.com/repos/eagleas/nglearn/pulls/5/comments","review_comment_url":"https://api.github.com/repos/eagleas/nglearn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eagleas/nglearn/issues/5/comments","statuses_url":"https://api.github.com/repos/eagleas/nglearn/statuses/0178220cf006ece77bc9defee9a9a760eaafec00","head":{"label":"eagleas:develop","ref":"develop","sha":"0178220cf006ece77bc9defee9a9a760eaafec00","user":{"login":"eagleas","id":9677,"avatar_url":"https://avatars.githubusercontent.com/u/9677?v=3","gravatar_id":"","url":"https://api.github.com/users/eagleas","html_url":"https://github.com/eagleas","followers_url":"https://api.github.com/users/eagleas/followers","following_url":"https://api.github.com/users/eagleas/following{/other_user}","gists_url":"https://api.github.com/users/eagleas/gists{/gist_id}","starred_url":"https://api.github.com/users/eagleas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eagleas/subscriptions","organizations_url":"https://api.github.com/users/eagleas/orgs","repos_url":"https://api.github.com/users/eagleas/repos","events_url":"https://api.github.com/users/eagleas/events{/privacy}","received_events_url":"https://api.github.com/users/eagleas/received_events","type":"User","site_admin":false},"repo":{"id":44050126,"name":"nglearn","full_name":"eagleas/nglearn","owner":{"login":"eagleas","id":9677,"avatar_url":"https://avatars.githubusercontent.com/u/9677?v=3","gravatar_id":"","url":"https://api.github.com/users/eagleas","html_url":"https://github.com/eagleas","followers_url":"https://api.github.com/users/eagleas/followers","following_url":"https://api.github.com/users/eagleas/following{/other_user}","gists_url":"https://api.github.com/users/eagleas/gists{/gist_id}","starred_url":"https://api.github.com/users/eagleas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eagleas/subscriptions","organizations_url":"https://api.github.com/users/eagleas/orgs","repos_url":"https://api.github.com/users/eagleas/repos","events_url":"https://api.github.com/users/eagleas/events{/privacy}","received_events_url":"https://api.github.com/users/eagleas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eagleas/nglearn","description":"AngularJS learning app","fork":false,"url":"https://api.github.com/repos/eagleas/nglearn","forks_url":"https://api.github.com/repos/eagleas/nglearn/forks","keys_url":"https://api.github.com/repos/eagleas/nglearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eagleas/nglearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eagleas/nglearn/teams","hooks_url":"https://api.github.com/repos/eagleas/nglearn/hooks","issue_events_url":"https://api.github.com/repos/eagleas/nglearn/issues/events{/number}","events_url":"https://api.github.com/repos/eagleas/nglearn/events","assignees_url":"https://api.github.com/repos/eagleas/nglearn/assignees{/user}","branches_url":"https://api.github.com/repos/eagleas/nglearn/branches{/branch}","tags_url":"https://api.github.com/repos/eagleas/nglearn/tags","blobs_url":"https://api.github.com/repos/eagleas/nglearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eagleas/nglearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eagleas/nglearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/eagleas/nglearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eagleas/nglearn/statuses/{sha}","languages_url":"https://api.github.com/repos/eagleas/nglearn/languages","stargazers_url":"https://api.github.com/repos/eagleas/nglearn/stargazers","contributors_url":"https://api.github.com/repos/eagleas/nglearn/contributors","subscribers_url":"https://api.github.com/repos/eagleas/nglearn/subscribers","subscription_url":"https://api.github.com/repos/eagleas/nglearn/subscription","commits_url":"https://api.github.com/repos/eagleas/nglearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/eagleas/nglearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/eagleas/nglearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/eagleas/nglearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/eagleas/nglearn/contents/{+path}","compare_url":"https://api.github.com/repos/eagleas/nglearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eagleas/nglearn/merges","archive_url":"https://api.github.com/repos/eagleas/nglearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eagleas/nglearn/downloads","issues_url":"https://api.github.com/repos/eagleas/nglearn/issues{/number}","pulls_url":"https://api.github.com/repos/eagleas/nglearn/pulls{/number}","milestones_url":"https://api.github.com/repos/eagleas/nglearn/milestones{/number}","notifications_url":"https://api.github.com/repos/eagleas/nglearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eagleas/nglearn/labels{/name}","releases_url":"https://api.github.com/repos/eagleas/nglearn/releases{/id}","created_at":"2015-10-11T11:49:37Z","updated_at":"2015-12-20T12:46:44Z","pushed_at":"2015-12-20T12:48:02Z","git_url":"git://github.com/eagleas/nglearn.git","ssh_url":"git@github.com:eagleas/nglearn.git","clone_url":"https://github.com/eagleas/nglearn.git","svn_url":"https://github.com/eagleas/nglearn","homepage":null,"size":233,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"eagleas:master","ref":"master","sha":"d068e2d568bc8aa525f0f9c686b57b5c98aa8d19","user":{"login":"eagleas","id":9677,"avatar_url":"https://avatars.githubusercontent.com/u/9677?v=3","gravatar_id":"","url":"https://api.github.com/users/eagleas","html_url":"https://github.com/eagleas","followers_url":"https://api.github.com/users/eagleas/followers","following_url":"https://api.github.com/users/eagleas/following{/other_user}","gists_url":"https://api.github.com/users/eagleas/gists{/gist_id}","starred_url":"https://api.github.com/users/eagleas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eagleas/subscriptions","organizations_url":"https://api.github.com/users/eagleas/orgs","repos_url":"https://api.github.com/users/eagleas/repos","events_url":"https://api.github.com/users/eagleas/events{/privacy}","received_events_url":"https://api.github.com/users/eagleas/received_events","type":"User","site_admin":false},"repo":{"id":44050126,"name":"nglearn","full_name":"eagleas/nglearn","owner":{"login":"eagleas","id":9677,"avatar_url":"https://avatars.githubusercontent.com/u/9677?v=3","gravatar_id":"","url":"https://api.github.com/users/eagleas","html_url":"https://github.com/eagleas","followers_url":"https://api.github.com/users/eagleas/followers","following_url":"https://api.github.com/users/eagleas/following{/other_user}","gists_url":"https://api.github.com/users/eagleas/gists{/gist_id}","starred_url":"https://api.github.com/users/eagleas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eagleas/subscriptions","organizations_url":"https://api.github.com/users/eagleas/orgs","repos_url":"https://api.github.com/users/eagleas/repos","events_url":"https://api.github.com/users/eagleas/events{/privacy}","received_events_url":"https://api.github.com/users/eagleas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eagleas/nglearn","description":"AngularJS learning app","fork":false,"url":"https://api.github.com/repos/eagleas/nglearn","forks_url":"https://api.github.com/repos/eagleas/nglearn/forks","keys_url":"https://api.github.com/repos/eagleas/nglearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eagleas/nglearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eagleas/nglearn/teams","hooks_url":"https://api.github.com/repos/eagleas/nglearn/hooks","issue_events_url":"https://api.github.com/repos/eagleas/nglearn/issues/events{/number}","events_url":"https://api.github.com/repos/eagleas/nglearn/events","assignees_url":"https://api.github.com/repos/eagleas/nglearn/assignees{/user}","branches_url":"https://api.github.com/repos/eagleas/nglearn/branches{/branch}","tags_url":"https://api.github.com/repos/eagleas/nglearn/tags","blobs_url":"https://api.github.com/repos/eagleas/nglearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eagleas/nglearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eagleas/nglearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/eagleas/nglearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eagleas/nglearn/statuses/{sha}","languages_url":"https://api.github.com/repos/eagleas/nglearn/languages","stargazers_url":"https://api.github.com/repos/eagleas/nglearn/stargazers","contributors_url":"https://api.github.com/repos/eagleas/nglearn/contributors","subscribers_url":"https://api.github.com/repos/eagleas/nglearn/subscribers","subscription_url":"https://api.github.com/repos/eagleas/nglearn/subscription","commits_url":"https://api.github.com/repos/eagleas/nglearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/eagleas/nglearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/eagleas/nglearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/eagleas/nglearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/eagleas/nglearn/contents/{+path}","compare_url":"https://api.github.com/repos/eagleas/nglearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eagleas/nglearn/merges","archive_url":"https://api.github.com/repos/eagleas/nglearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eagleas/nglearn/downloads","issues_url":"https://api.github.com/repos/eagleas/nglearn/issues{/number}","pulls_url":"https://api.github.com/repos/eagleas/nglearn/pulls{/number}","milestones_url":"https://api.github.com/repos/eagleas/nglearn/milestones{/number}","notifications_url":"https://api.github.com/repos/eagleas/nglearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eagleas/nglearn/labels{/name}","releases_url":"https://api.github.com/repos/eagleas/nglearn/releases{/id}","created_at":"2015-10-11T11:49:37Z","updated_at":"2015-12-20T12:46:44Z","pushed_at":"2015-12-20T12:48:02Z","git_url":"git://github.com/eagleas/nglearn.git","ssh_url":"git@github.com:eagleas/nglearn.git","clone_url":"https://github.com/eagleas/nglearn.git","svn_url":"https://github.com/eagleas/nglearn","homepage":null,"size":233,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/eagleas/nglearn/pulls/5"},"html":{"href":"https://github.com/eagleas/nglearn/pull/5"},"issue":{"href":"https://api.github.com/repos/eagleas/nglearn/issues/5"},"comments":{"href":"https://api.github.com/repos/eagleas/nglearn/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/eagleas/nglearn/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/eagleas/nglearn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eagleas/nglearn/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/eagleas/nglearn/statuses/0178220cf006ece77bc9defee9a9a760eaafec00"}}}}