{"action":"created","comment":{"url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/comments/87693414","pull_request_review_id":8298675,"id":87693414,"diff_hunk":"@@ -0,0 +1,60 @@\n+require 'rails_helper'\n+\n+shared_examples 'searching' do |query, type|\n+  let(:model) do\n+    type == 'all' ? ThinkingSphinx : type.underscore.classify.constantize\n+  end\n+\n+  it 'receives perform_search for Search' do\n+    expect(Search).to receive(:perform_search).with(query, type)\n+    Search.query(query, type)\n+  end\n+end\n+\n+RSpec.describe Search, type: :sphinx do\n+  describe '::SEARCH_TYPES' do\n+    it 'returns search_types' do\n+      expect(described_class::SEARCH_TYPES).to eq %w(all question answer comment user)\n+    end\n+  end\n+\n+  describe '.perform_search' do\n+    it 'receives escaped data', :aggregate_failures do\n+      query = 'need@escape.com'\n+      escaped = Riddle::Query.escape(query)\n+      expect(Riddle::Query).to receive(:escape).with(query).and_call_original\n+      expect(ThinkingSphinx).to receive(:search).with(escaped)\n+      described_class.perform_search(query, 'all')\n+    end\n+  end\n+\n+  describe '.query' do\n+    it 'searches', :aggregate_failures do\n+      user = create(:user)\n+      question = create(:question, user: user)\n+      answer = create(:answer, question: question, user: user)\n+      comment = create(:comment, commentable: answer, user: user)\n+      index\n+      expect(described_class.query('', 'all')).to match_array [user, question, answer, comment]","path":"spec/models/search_spec.rb","position":38,"original_position":38,"commit_id":"296b535349dc501544c9631666a7c1da8126793e","original_commit_id":"296b535349dc501544c9631666a7c1da8126793e","user":{"login":"vkurennov","id":968537,"avatar_url":"https://avatars.githubusercontent.com/u/968537?v=3","gravatar_id":"","url":"https://api.github.com/users/vkurennov","html_url":"https://github.com/vkurennov","followers_url":"https://api.github.com/users/vkurennov/followers","following_url":"https://api.github.com/users/vkurennov/following{/other_user}","gists_url":"https://api.github.com/users/vkurennov/gists{/gist_id}","starred_url":"https://api.github.com/users/vkurennov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkurennov/subscriptions","organizations_url":"https://api.github.com/users/vkurennov/orgs","repos_url":"https://api.github.com/users/vkurennov/repos","events_url":"https://api.github.com/users/vkurennov/events{/privacy}","received_events_url":"https://api.github.com/users/vkurennov/received_events","type":"User","site_admin":false},"body":"Тут не надо провериять работоспособность поиска, он же осуществляется сфинксом. Достаточно просто проверять, что вызыватся метод search у нужного класса с нужными параметрами.","created_at":"2016-11-12T14:21:52Z","updated_at":"2016-11-12T14:22:12Z","html_url":"https://github.com/sergeybormotov/stkwrfl2/pull/16#discussion_r87693414","pull_request_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/comments/87693414"},"html":{"href":"https://github.com/sergeybormotov/stkwrfl2/pull/16#discussion_r87693414"},"pull_request":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16","id":93438635,"html_url":"https://github.com/sergeybormotov/stkwrfl2/pull/16","diff_url":"https://github.com/sergeybormotov/stkwrfl2/pull/16.diff","patch_url":"https://github.com/sergeybormotov/stkwrfl2/pull/16.patch","issue_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/16","number":16,"state":"open","locked":false,"title":"Lesson18/sphinx","user":{"login":"sergeybormotov","id":18641377,"avatar_url":"https://avatars.githubusercontent.com/u/18641377?v=3","gravatar_id":"","url":"https://api.github.com/users/sergeybormotov","html_url":"https://github.com/sergeybormotov","followers_url":"https://api.github.com/users/sergeybormotov/followers","following_url":"https://api.github.com/users/sergeybormotov/following{/other_user}","gists_url":"https://api.github.com/users/sergeybormotov/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeybormotov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeybormotov/subscriptions","organizations_url":"https://api.github.com/users/sergeybormotov/orgs","repos_url":"https://api.github.com/users/sergeybormotov/repos","events_url":"https://api.github.com/users/sergeybormotov/events{/privacy}","received_events_url":"https://api.github.com/users/sergeybormotov/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-12T13:11:08Z","updated_at":"2016-11-12T14:22:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88325a678b49a051b1a4df4eb301b8f8c7e533b5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16/commits","review_comments_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16/comments","review_comment_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/16/comments","statuses_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/statuses/296b535349dc501544c9631666a7c1da8126793e","head":{"label":"sergeybormotov:lesson18/sphinx","ref":"lesson18/sphinx","sha":"296b535349dc501544c9631666a7c1da8126793e","user":{"login":"sergeybormotov","id":18641377,"avatar_url":"https://avatars.githubusercontent.com/u/18641377?v=3","gravatar_id":"","url":"https://api.github.com/users/sergeybormotov","html_url":"https://github.com/sergeybormotov","followers_url":"https://api.github.com/users/sergeybormotov/followers","following_url":"https://api.github.com/users/sergeybormotov/following{/other_user}","gists_url":"https://api.github.com/users/sergeybormotov/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeybormotov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeybormotov/subscriptions","organizations_url":"https://api.github.com/users/sergeybormotov/orgs","repos_url":"https://api.github.com/users/sergeybormotov/repos","events_url":"https://api.github.com/users/sergeybormotov/events{/privacy}","received_events_url":"https://api.github.com/users/sergeybormotov/received_events","type":"User","site_admin":false},"repo":{"id":65756876,"name":"stkwrfl2","full_name":"sergeybormotov/stkwrfl2","owner":{"login":"sergeybormotov","id":18641377,"avatar_url":"https://avatars.githubusercontent.com/u/18641377?v=3","gravatar_id":"","url":"https://api.github.com/users/sergeybormotov","html_url":"https://github.com/sergeybormotov","followers_url":"https://api.github.com/users/sergeybormotov/followers","following_url":"https://api.github.com/users/sergeybormotov/following{/other_user}","gists_url":"https://api.github.com/users/sergeybormotov/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeybormotov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeybormotov/subscriptions","organizations_url":"https://api.github.com/users/sergeybormotov/orgs","repos_url":"https://api.github.com/users/sergeybormotov/repos","events_url":"https://api.github.com/users/sergeybormotov/events{/privacy}","received_events_url":"https://api.github.com/users/sergeybormotov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sergeybormotov/stkwrfl2","description":null,"fork":false,"url":"https://api.github.com/repos/sergeybormotov/stkwrfl2","forks_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/forks","keys_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/teams","hooks_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/hooks","issue_events_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/events{/number}","events_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/events","assignees_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/assignees{/user}","branches_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/branches{/branch}","tags_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/tags","blobs_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/refs{/sha}","trees_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/statuses/{sha}","languages_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/languages","stargazers_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/stargazers","contributors_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/contributors","subscribers_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/subscribers","subscription_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/subscription","commits_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/commits{/sha}","git_commits_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/commits{/sha}","comments_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/comments{/number}","issue_comment_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/comments{/number}","contents_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/contents/{+path}","compare_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/merges","archive_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/downloads","issues_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues{/number}","pulls_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls{/number}","milestones_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/milestones{/number}","notifications_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/labels{/name}","releases_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/releases{/id}","deployments_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/deployments","created_at":"2016-08-15T18:55:28Z","updated_at":"2016-08-16T19:06:59Z","pushed_at":"2016-11-12T13:11:08Z","git_url":"git://github.com/sergeybormotov/stkwrfl2.git","ssh_url":"git@github.com:sergeybormotov/stkwrfl2.git","clone_url":"https://github.com/sergeybormotov/stkwrfl2.git","svn_url":"https://github.com/sergeybormotov/stkwrfl2","homepage":null,"size":228,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"master"}},"base":{"label":"sergeybormotov:master","ref":"master","sha":"3b046761ea6011da1b9e66f60cac9b4c6ee6d0d5","user":{"login":"sergeybormotov","id":18641377,"avatar_url":"https://avatars.githubusercontent.com/u/18641377?v=3","gravatar_id":"","url":"https://api.github.com/users/sergeybormotov","html_url":"https://github.com/sergeybormotov","followers_url":"https://api.github.com/users/sergeybormotov/followers","following_url":"https://api.github.com/users/sergeybormotov/following{/other_user}","gists_url":"https://api.github.com/users/sergeybormotov/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeybormotov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeybormotov/subscriptions","organizations_url":"https://api.github.com/users/sergeybormotov/orgs","repos_url":"https://api.github.com/users/sergeybormotov/repos","events_url":"https://api.github.com/users/sergeybormotov/events{/privacy}","received_events_url":"https://api.github.com/users/sergeybormotov/received_events","type":"User","site_admin":false},"repo":{"id":65756876,"name":"stkwrfl2","full_name":"sergeybormotov/stkwrfl2","owner":{"login":"sergeybormotov","id":18641377,"avatar_url":"https://avatars.githubusercontent.com/u/18641377?v=3","gravatar_id":"","url":"https://api.github.com/users/sergeybormotov","html_url":"https://github.com/sergeybormotov","followers_url":"https://api.github.com/users/sergeybormotov/followers","following_url":"https://api.github.com/users/sergeybormotov/following{/other_user}","gists_url":"https://api.github.com/users/sergeybormotov/gists{/gist_id}","starred_url":"https://api.github.com/users/sergeybormotov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergeybormotov/subscriptions","organizations_url":"https://api.github.com/users/sergeybormotov/orgs","repos_url":"https://api.github.com/users/sergeybormotov/repos","events_url":"https://api.github.com/users/sergeybormotov/events{/privacy}","received_events_url":"https://api.github.com/users/sergeybormotov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sergeybormotov/stkwrfl2","description":null,"fork":false,"url":"https://api.github.com/repos/sergeybormotov/stkwrfl2","forks_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/forks","keys_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/teams","hooks_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/hooks","issue_events_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/events{/number}","events_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/events","assignees_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/assignees{/user}","branches_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/branches{/branch}","tags_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/tags","blobs_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/refs{/sha}","trees_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/statuses/{sha}","languages_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/languages","stargazers_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/stargazers","contributors_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/contributors","subscribers_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/subscribers","subscription_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/subscription","commits_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/commits{/sha}","git_commits_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/git/commits{/sha}","comments_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/comments{/number}","issue_comment_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/comments{/number}","contents_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/contents/{+path}","compare_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/merges","archive_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/downloads","issues_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues{/number}","pulls_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls{/number}","milestones_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/milestones{/number}","notifications_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/labels{/name}","releases_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/releases{/id}","deployments_url":"https://api.github.com/repos/sergeybormotov/stkwrfl2/deployments","created_at":"2016-08-15T18:55:28Z","updated_at":"2016-08-16T19:06:59Z","pushed_at":"2016-11-12T13:11:08Z","git_url":"git://github.com/sergeybormotov/stkwrfl2.git","ssh_url":"git@github.com:sergeybormotov/stkwrfl2.git","clone_url":"https://github.com/sergeybormotov/stkwrfl2.git","svn_url":"https://github.com/sergeybormotov/stkwrfl2","homepage":null,"size":228,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16"},"html":{"href":"https://github.com/sergeybormotov/stkwrfl2/pull/16"},"issue":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/16"},"comments":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/sergeybormotov/stkwrfl2/statuses/296b535349dc501544c9631666a7c1da8126793e"}}}}
{"actor":{"display_login":"vkurennov"}}