{"action":"created","comment":{"url":"https://api.github.com/repos/lHydra/sevdol/pulls/comments/33894214","id":33894214,"diff_hunk":"@@ -0,0 +1,45 @@\n+require 'rails_helper'\n+require 'cancan/matchers'\n+\n+RSpec.describe 'Ability', type: :contoller do\n+  let!(:post) { Post.new }\n+\n+  describe 'abilities for admin' do\n+    before(:each) do\n+      Role.create(id: 1, name: 'admin')\n+      @user = create(:user, role_id: 1)\n+      @ability = Ability.new(@user)\n+    end\n+\n+    it 'admin can destroy post' do\n+      assert @ability.can?(:destroy, :post)\n+    end\n+\n+    it 'admin can create new post' do\n+      assert @ability.can?(:create, :post)\n+    end\n+\n+    it 'admin can edit post' do\n+      assert @ability.can?(:edit, :post)\n+    end\n+  end\n+\n+  describe 'abilities for guest' do\n+    before(:each) do\n+      @user = create(:user)\n+      @ability = Ability.new(@user)\n+    end\n+\n+    it 'guest cannot destroy post' do\n+      assert @ability.cannot?(:destroy, :post)\n+    end\n+\n+    it 'guest cannot create new post' do\n+      assert @ability.cannot?(:create, :post)\n+    end\n+\n+    it 'guest cannot edit post' do\n+      assert @ability.cannot?(:edit, :post)\n+    end\n+  end\n+end","path":"spec/models/ability_spec.rb","position":45,"original_position":45,"commit_id":"73bf06612c9caeef5402da83147e5678d7a36405","original_commit_id":"73bf06612c9caeef5402da83147e5678d7a36405","user":{"login":"renius","id":348887,"avatar_url":"https://avatars.githubusercontent.com/u/348887?v=3","gravatar_id":"","url":"https://api.github.com/users/renius","html_url":"https://github.com/renius","followers_url":"https://api.github.com/users/renius/followers","following_url":"https://api.github.com/users/renius/following{/other_user}","gists_url":"https://api.github.com/users/renius/gists{/gist_id}","starred_url":"https://api.github.com/users/renius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renius/subscriptions","organizations_url":"https://api.github.com/users/renius/orgs","repos_url":"https://api.github.com/users/renius/repos","events_url":"https://api.github.com/users/renius/events{/privacy}","received_events_url":"https://api.github.com/users/renius/received_events","type":"User","site_admin":false},"body":"какая-то адская сместь rspec и minitest\r\nу нас rspec","created_at":"2015-07-05T11:51:51Z","updated_at":"2015-07-05T11:51:51Z","html_url":"https://github.com/lHydra/sevdol/pull/23#discussion_r33894214","pull_request_url":"https://api.github.com/repos/lHydra/sevdol/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/lHydra/sevdol/pulls/comments/33894214"},"html":{"href":"https://github.com/lHydra/sevdol/pull/23#discussion_r33894214"},"pull_request":{"href":"https://api.github.com/repos/lHydra/sevdol/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/lHydra/sevdol/pulls/23","id":39166186,"html_url":"https://github.com/lHydra/sevdol/pull/23","diff_url":"https://github.com/lHydra/sevdol/pull/23.diff","patch_url":"https://github.com/lHydra/sevdol/pull/23.patch","issue_url":"https://api.github.com/repos/lHydra/sevdol/issues/23","number":23,"state":"open","locked":false,"title":"Feature/g add cancan","user":{"login":"lHydra","id":11439679,"avatar_url":"https://avatars.githubusercontent.com/u/11439679?v=3","gravatar_id":"","url":"https://api.github.com/users/lHydra","html_url":"https://github.com/lHydra","followers_url":"https://api.github.com/users/lHydra/followers","following_url":"https://api.github.com/users/lHydra/following{/other_user}","gists_url":"https://api.github.com/users/lHydra/gists{/gist_id}","starred_url":"https://api.github.com/users/lHydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lHydra/subscriptions","organizations_url":"https://api.github.com/users/lHydra/orgs","repos_url":"https://api.github.com/users/lHydra/repos","events_url":"https://api.github.com/users/lHydra/events{/privacy}","received_events_url":"https://api.github.com/users/lHydra/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-03T11:02:52Z","updated_at":"2015-07-05T11:51:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42cb23d0fb9960ac19b72abc5ea8237c3f99562f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lHydra/sevdol/pulls/23/commits","review_comments_url":"https://api.github.com/repos/lHydra/sevdol/pulls/23/comments","review_comment_url":"https://api.github.com/repos/lHydra/sevdol/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lHydra/sevdol/issues/23/comments","statuses_url":"https://api.github.com/repos/lHydra/sevdol/statuses/73bf06612c9caeef5402da83147e5678d7a36405","head":{"label":"lHydra:feature/g-add-cancan","ref":"feature/g-add-cancan","sha":"73bf06612c9caeef5402da83147e5678d7a36405","user":{"login":"lHydra","id":11439679,"avatar_url":"https://avatars.githubusercontent.com/u/11439679?v=3","gravatar_id":"","url":"https://api.github.com/users/lHydra","html_url":"https://github.com/lHydra","followers_url":"https://api.github.com/users/lHydra/followers","following_url":"https://api.github.com/users/lHydra/following{/other_user}","gists_url":"https://api.github.com/users/lHydra/gists{/gist_id}","starred_url":"https://api.github.com/users/lHydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lHydra/subscriptions","organizations_url":"https://api.github.com/users/lHydra/orgs","repos_url":"https://api.github.com/users/lHydra/repos","events_url":"https://api.github.com/users/lHydra/events{/privacy}","received_events_url":"https://api.github.com/users/lHydra/received_events","type":"User","site_admin":false},"repo":{"id":36854497,"name":"sevdol","full_name":"lHydra/sevdol","owner":{"login":"lHydra","id":11439679,"avatar_url":"https://avatars.githubusercontent.com/u/11439679?v=3","gravatar_id":"","url":"https://api.github.com/users/lHydra","html_url":"https://github.com/lHydra","followers_url":"https://api.github.com/users/lHydra/followers","following_url":"https://api.github.com/users/lHydra/following{/other_user}","gists_url":"https://api.github.com/users/lHydra/gists{/gist_id}","starred_url":"https://api.github.com/users/lHydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lHydra/subscriptions","organizations_url":"https://api.github.com/users/lHydra/orgs","repos_url":"https://api.github.com/users/lHydra/repos","events_url":"https://api.github.com/users/lHydra/events{/privacy}","received_events_url":"https://api.github.com/users/lHydra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lHydra/sevdol","description":"","fork":false,"url":"https://api.github.com/repos/lHydra/sevdol","forks_url":"https://api.github.com/repos/lHydra/sevdol/forks","keys_url":"https://api.github.com/repos/lHydra/sevdol/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lHydra/sevdol/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lHydra/sevdol/teams","hooks_url":"https://api.github.com/repos/lHydra/sevdol/hooks","issue_events_url":"https://api.github.com/repos/lHydra/sevdol/issues/events{/number}","events_url":"https://api.github.com/repos/lHydra/sevdol/events","assignees_url":"https://api.github.com/repos/lHydra/sevdol/assignees{/user}","branches_url":"https://api.github.com/repos/lHydra/sevdol/branches{/branch}","tags_url":"https://api.github.com/repos/lHydra/sevdol/tags","blobs_url":"https://api.github.com/repos/lHydra/sevdol/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lHydra/sevdol/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lHydra/sevdol/git/refs{/sha}","trees_url":"https://api.github.com/repos/lHydra/sevdol/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lHydra/sevdol/statuses/{sha}","languages_url":"https://api.github.com/repos/lHydra/sevdol/languages","stargazers_url":"https://api.github.com/repos/lHydra/sevdol/stargazers","contributors_url":"https://api.github.com/repos/lHydra/sevdol/contributors","subscribers_url":"https://api.github.com/repos/lHydra/sevdol/subscribers","subscription_url":"https://api.github.com/repos/lHydra/sevdol/subscription","commits_url":"https://api.github.com/repos/lHydra/sevdol/commits{/sha}","git_commits_url":"https://api.github.com/repos/lHydra/sevdol/git/commits{/sha}","comments_url":"https://api.github.com/repos/lHydra/sevdol/comments{/number}","issue_comment_url":"https://api.github.com/repos/lHydra/sevdol/issues/comments{/number}","contents_url":"https://api.github.com/repos/lHydra/sevdol/contents/{+path}","compare_url":"https://api.github.com/repos/lHydra/sevdol/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lHydra/sevdol/merges","archive_url":"https://api.github.com/repos/lHydra/sevdol/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lHydra/sevdol/downloads","issues_url":"https://api.github.com/repos/lHydra/sevdol/issues{/number}","pulls_url":"https://api.github.com/repos/lHydra/sevdol/pulls{/number}","milestones_url":"https://api.github.com/repos/lHydra/sevdol/milestones{/number}","notifications_url":"https://api.github.com/repos/lHydra/sevdol/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lHydra/sevdol/labels{/name}","releases_url":"https://api.github.com/repos/lHydra/sevdol/releases{/id}","created_at":"2015-06-04T07:15:27Z","updated_at":"2015-06-29T06:41:09Z","pushed_at":"2015-07-05T11:44:50Z","git_url":"git://github.com/lHydra/sevdol.git","ssh_url":"git@github.com:lHydra/sevdol.git","clone_url":"https://github.com/lHydra/sevdol.git","svn_url":"https://github.com/lHydra/sevdol","homepage":null,"size":472,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"lHydra:master","ref":"master","sha":"26be9c2aa25779572fe78480c267526de11baf6e","user":{"login":"lHydra","id":11439679,"avatar_url":"https://avatars.githubusercontent.com/u/11439679?v=3","gravatar_id":"","url":"https://api.github.com/users/lHydra","html_url":"https://github.com/lHydra","followers_url":"https://api.github.com/users/lHydra/followers","following_url":"https://api.github.com/users/lHydra/following{/other_user}","gists_url":"https://api.github.com/users/lHydra/gists{/gist_id}","starred_url":"https://api.github.com/users/lHydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lHydra/subscriptions","organizations_url":"https://api.github.com/users/lHydra/orgs","repos_url":"https://api.github.com/users/lHydra/repos","events_url":"https://api.github.com/users/lHydra/events{/privacy}","received_events_url":"https://api.github.com/users/lHydra/received_events","type":"User","site_admin":false},"repo":{"id":36854497,"name":"sevdol","full_name":"lHydra/sevdol","owner":{"login":"lHydra","id":11439679,"avatar_url":"https://avatars.githubusercontent.com/u/11439679?v=3","gravatar_id":"","url":"https://api.github.com/users/lHydra","html_url":"https://github.com/lHydra","followers_url":"https://api.github.com/users/lHydra/followers","following_url":"https://api.github.com/users/lHydra/following{/other_user}","gists_url":"https://api.github.com/users/lHydra/gists{/gist_id}","starred_url":"https://api.github.com/users/lHydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lHydra/subscriptions","organizations_url":"https://api.github.com/users/lHydra/orgs","repos_url":"https://api.github.com/users/lHydra/repos","events_url":"https://api.github.com/users/lHydra/events{/privacy}","received_events_url":"https://api.github.com/users/lHydra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lHydra/sevdol","description":"","fork":false,"url":"https://api.github.com/repos/lHydra/sevdol","forks_url":"https://api.github.com/repos/lHydra/sevdol/forks","keys_url":"https://api.github.com/repos/lHydra/sevdol/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lHydra/sevdol/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lHydra/sevdol/teams","hooks_url":"https://api.github.com/repos/lHydra/sevdol/hooks","issue_events_url":"https://api.github.com/repos/lHydra/sevdol/issues/events{/number}","events_url":"https://api.github.com/repos/lHydra/sevdol/events","assignees_url":"https://api.github.com/repos/lHydra/sevdol/assignees{/user}","branches_url":"https://api.github.com/repos/lHydra/sevdol/branches{/branch}","tags_url":"https://api.github.com/repos/lHydra/sevdol/tags","blobs_url":"https://api.github.com/repos/lHydra/sevdol/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lHydra/sevdol/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lHydra/sevdol/git/refs{/sha}","trees_url":"https://api.github.com/repos/lHydra/sevdol/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lHydra/sevdol/statuses/{sha}","languages_url":"https://api.github.com/repos/lHydra/sevdol/languages","stargazers_url":"https://api.github.com/repos/lHydra/sevdol/stargazers","contributors_url":"https://api.github.com/repos/lHydra/sevdol/contributors","subscribers_url":"https://api.github.com/repos/lHydra/sevdol/subscribers","subscription_url":"https://api.github.com/repos/lHydra/sevdol/subscription","commits_url":"https://api.github.com/repos/lHydra/sevdol/commits{/sha}","git_commits_url":"https://api.github.com/repos/lHydra/sevdol/git/commits{/sha}","comments_url":"https://api.github.com/repos/lHydra/sevdol/comments{/number}","issue_comment_url":"https://api.github.com/repos/lHydra/sevdol/issues/comments{/number}","contents_url":"https://api.github.com/repos/lHydra/sevdol/contents/{+path}","compare_url":"https://api.github.com/repos/lHydra/sevdol/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lHydra/sevdol/merges","archive_url":"https://api.github.com/repos/lHydra/sevdol/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lHydra/sevdol/downloads","issues_url":"https://api.github.com/repos/lHydra/sevdol/issues{/number}","pulls_url":"https://api.github.com/repos/lHydra/sevdol/pulls{/number}","milestones_url":"https://api.github.com/repos/lHydra/sevdol/milestones{/number}","notifications_url":"https://api.github.com/repos/lHydra/sevdol/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lHydra/sevdol/labels{/name}","releases_url":"https://api.github.com/repos/lHydra/sevdol/releases{/id}","created_at":"2015-06-04T07:15:27Z","updated_at":"2015-06-29T06:41:09Z","pushed_at":"2015-07-05T11:44:50Z","git_url":"git://github.com/lHydra/sevdol.git","ssh_url":"git@github.com:lHydra/sevdol.git","clone_url":"https://github.com/lHydra/sevdol.git","svn_url":"https://github.com/lHydra/sevdol","homepage":null,"size":472,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lHydra/sevdol/pulls/23"},"html":{"href":"https://github.com/lHydra/sevdol/pull/23"},"issue":{"href":"https://api.github.com/repos/lHydra/sevdol/issues/23"},"comments":{"href":"https://api.github.com/repos/lHydra/sevdol/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/lHydra/sevdol/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/lHydra/sevdol/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lHydra/sevdol/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/lHydra/sevdol/statuses/73bf06612c9caeef5402da83147e5678d7a36405"}}}}