{"action":"created","comment":{"url":"https://api.github.com/repos/lastcat/factory_logger/pulls/comments/31505323","id":31505323,"diff_hunk":"@@ -81,6 +90,42 @@\n         Factory.create_unique_factory(name: \"factory1\", traits: [\"trait2_of_factory1\"], assos:[])\n         expect(Trait.any? { |trait| trait.name == \"trait2_of_factory1\" && trait.trait_relations.first.factory.name == \"factory1\" }).to eq true\n       end\n+\n+      context \"create trait relation for already existing trait\" do\n+        let!(:existing_trait) { create :trait, name: \"existing_trait\" }\n+        let!(:trait_relation) { create :trait_relation, factory_id: factory1.id, trait_id: existing_trait.id }\n+        it \"create new trait relation\" do\n+          expect do\n+            Factory.create_unique_factory(\n+                                           name: \"factory1\",\n+                                           traits: [\"existing_trait\", \"not_existing_trait\"],\n+                                           assos: []\n+                                         )\n+          end.to change { TraitRelation.all.size }.from(1).to(3)\n+        end\n+        it \"don't create new trait\" do\n+          expect do\n+             Factory.create_unique_factory(","path":"spec/models/factory_spec.rb","position":37,"original_position":37,"commit_id":"0cd14b376055162a40bad4935916ace2013b9170","original_commit_id":"0cd14b376055162a40bad4935916ace2013b9170","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Style/IndentationWidth: Use 2 (not 3) spaces for indentation.","created_at":"2015-06-02T09:23:34Z","updated_at":"2015-06-02T09:23:34Z","html_url":"https://github.com/lastcat/factory_logger/pull/37#discussion_r31505323","pull_request_url":"https://api.github.com/repos/lastcat/factory_logger/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/lastcat/factory_logger/pulls/comments/31505323"},"html":{"href":"https://github.com/lastcat/factory_logger/pull/37#discussion_r31505323"},"pull_request":{"href":"https://api.github.com/repos/lastcat/factory_logger/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/lastcat/factory_logger/pulls/37","id":36707240,"html_url":"https://github.com/lastcat/factory_logger/pull/37","diff_url":"https://github.com/lastcat/factory_logger/pull/37.diff","patch_url":"https://github.com/lastcat/factory_logger/pull/37.patch","issue_url":"https://api.github.com/repos/lastcat/factory_logger/issues/37","number":37,"state":"open","locked":false,"title":"Use redis","user":{"login":"lastcat","id":2026375,"avatar_url":"https://avatars.githubusercontent.com/u/2026375?v=3","gravatar_id":"","url":"https://api.github.com/users/lastcat","html_url":"https://github.com/lastcat","followers_url":"https://api.github.com/users/lastcat/followers","following_url":"https://api.github.com/users/lastcat/following{/other_user}","gists_url":"https://api.github.com/users/lastcat/gists{/gist_id}","starred_url":"https://api.github.com/users/lastcat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lastcat/subscriptions","organizations_url":"https://api.github.com/users/lastcat/orgs","repos_url":"https://api.github.com/users/lastcat/repos","events_url":"https://api.github.com/users/lastcat/events{/privacy}","received_events_url":"https://api.github.com/users/lastcat/received_events","type":"User","site_admin":false},"body":"重複チェックにredisを使うようにした。Model.any?とかよりは早い(と思う)","created_at":"2015-06-02T09:01:59Z","updated_at":"2015-06-02T09:23:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fc7f806ed5ef8eb42268233ec409a0aab6e58ca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lastcat/factory_logger/pulls/37/commits","review_comments_url":"https://api.github.com/repos/lastcat/factory_logger/pulls/37/comments","review_comment_url":"https://api.github.com/repos/lastcat/factory_logger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lastcat/factory_logger/issues/37/comments","statuses_url":"https://api.github.com/repos/lastcat/factory_logger/statuses/0cd14b376055162a40bad4935916ace2013b9170","head":{"label":"lastcat:use_redis","ref":"use_redis","sha":"0cd14b376055162a40bad4935916ace2013b9170","user":{"login":"lastcat","id":2026375,"avatar_url":"https://avatars.githubusercontent.com/u/2026375?v=3","gravatar_id":"","url":"https://api.github.com/users/lastcat","html_url":"https://github.com/lastcat","followers_url":"https://api.github.com/users/lastcat/followers","following_url":"https://api.github.com/users/lastcat/following{/other_user}","gists_url":"https://api.github.com/users/lastcat/gists{/gist_id}","starred_url":"https://api.github.com/users/lastcat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lastcat/subscriptions","organizations_url":"https://api.github.com/users/lastcat/orgs","repos_url":"https://api.github.com/users/lastcat/repos","events_url":"https://api.github.com/users/lastcat/events{/privacy}","received_events_url":"https://api.github.com/users/lastcat/received_events","type":"User","site_admin":false},"repo":{"id":36217773,"name":"factory_logger","full_name":"lastcat/factory_logger","owner":{"login":"lastcat","id":2026375,"avatar_url":"https://avatars.githubusercontent.com/u/2026375?v=3","gravatar_id":"","url":"https://api.github.com/users/lastcat","html_url":"https://github.com/lastcat","followers_url":"https://api.github.com/users/lastcat/followers","following_url":"https://api.github.com/users/lastcat/following{/other_user}","gists_url":"https://api.github.com/users/lastcat/gists{/gist_id}","starred_url":"https://api.github.com/users/lastcat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lastcat/subscriptions","organizations_url":"https://api.github.com/users/lastcat/orgs","repos_url":"https://api.github.com/users/lastcat/repos","events_url":"https://api.github.com/users/lastcat/events{/privacy}","received_events_url":"https://api.github.com/users/lastcat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lastcat/factory_logger","description":"This is gem logging factory_girl execution info.","fork":false,"url":"https://api.github.com/repos/lastcat/factory_logger","forks_url":"https://api.github.com/repos/lastcat/factory_logger/forks","keys_url":"https://api.github.com/repos/lastcat/factory_logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lastcat/factory_logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lastcat/factory_logger/teams","hooks_url":"https://api.github.com/repos/lastcat/factory_logger/hooks","issue_events_url":"https://api.github.com/repos/lastcat/factory_logger/issues/events{/number}","events_url":"https://api.github.com/repos/lastcat/factory_logger/events","assignees_url":"https://api.github.com/repos/lastcat/factory_logger/assignees{/user}","branches_url":"https://api.github.com/repos/lastcat/factory_logger/branches{/branch}","tags_url":"https://api.github.com/repos/lastcat/factory_logger/tags","blobs_url":"https://api.github.com/repos/lastcat/factory_logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lastcat/factory_logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lastcat/factory_logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/lastcat/factory_logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lastcat/factory_logger/statuses/{sha}","languages_url":"https://api.github.com/repos/lastcat/factory_logger/languages","stargazers_url":"https://api.github.com/repos/lastcat/factory_logger/stargazers","contributors_url":"https://api.github.com/repos/lastcat/factory_logger/contributors","subscribers_url":"https://api.github.com/repos/lastcat/factory_logger/subscribers","subscription_url":"https://api.github.com/repos/lastcat/factory_logger/subscription","commits_url":"https://api.github.com/repos/lastcat/factory_logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/lastcat/factory_logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/lastcat/factory_logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/lastcat/factory_logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/lastcat/factory_logger/contents/{+path}","compare_url":"https://api.github.com/repos/lastcat/factory_logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lastcat/factory_logger/merges","archive_url":"https://api.github.com/repos/lastcat/factory_logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lastcat/factory_logger/downloads","issues_url":"https://api.github.com/repos/lastcat/factory_logger/issues{/number}","pulls_url":"https://api.github.com/repos/lastcat/factory_logger/pulls{/number}","milestones_url":"https://api.github.com/repos/lastcat/factory_logger/milestones{/number}","notifications_url":"https://api.github.com/repos/lastcat/factory_logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lastcat/factory_logger/labels{/name}","releases_url":"https://api.github.com/repos/lastcat/factory_logger/releases{/id}","created_at":"2015-05-25T07:52:39Z","updated_at":"2015-05-25T07:53:34Z","pushed_at":"2015-06-02T09:23:22Z","git_url":"git://github.com/lastcat/factory_logger.git","ssh_url":"git@github.com:lastcat/factory_logger.git","clone_url":"https://github.com/lastcat/factory_logger.git","svn_url":"https://github.com/lastcat/factory_logger","homepage":null,"size":1196,"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":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"lastcat:master","ref":"master","sha":"2ae070a3396de4ee5df03fba0b7be26452666b2d","user":{"login":"lastcat","id":2026375,"avatar_url":"https://avatars.githubusercontent.com/u/2026375?v=3","gravatar_id":"","url":"https://api.github.com/users/lastcat","html_url":"https://github.com/lastcat","followers_url":"https://api.github.com/users/lastcat/followers","following_url":"https://api.github.com/users/lastcat/following{/other_user}","gists_url":"https://api.github.com/users/lastcat/gists{/gist_id}","starred_url":"https://api.github.com/users/lastcat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lastcat/subscriptions","organizations_url":"https://api.github.com/users/lastcat/orgs","repos_url":"https://api.github.com/users/lastcat/repos","events_url":"https://api.github.com/users/lastcat/events{/privacy}","received_events_url":"https://api.github.com/users/lastcat/received_events","type":"User","site_admin":false},"repo":{"id":36217773,"name":"factory_logger","full_name":"lastcat/factory_logger","owner":{"login":"lastcat","id":2026375,"avatar_url":"https://avatars.githubusercontent.com/u/2026375?v=3","gravatar_id":"","url":"https://api.github.com/users/lastcat","html_url":"https://github.com/lastcat","followers_url":"https://api.github.com/users/lastcat/followers","following_url":"https://api.github.com/users/lastcat/following{/other_user}","gists_url":"https://api.github.com/users/lastcat/gists{/gist_id}","starred_url":"https://api.github.com/users/lastcat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lastcat/subscriptions","organizations_url":"https://api.github.com/users/lastcat/orgs","repos_url":"https://api.github.com/users/lastcat/repos","events_url":"https://api.github.com/users/lastcat/events{/privacy}","received_events_url":"https://api.github.com/users/lastcat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lastcat/factory_logger","description":"This is gem logging factory_girl execution info.","fork":false,"url":"https://api.github.com/repos/lastcat/factory_logger","forks_url":"https://api.github.com/repos/lastcat/factory_logger/forks","keys_url":"https://api.github.com/repos/lastcat/factory_logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lastcat/factory_logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lastcat/factory_logger/teams","hooks_url":"https://api.github.com/repos/lastcat/factory_logger/hooks","issue_events_url":"https://api.github.com/repos/lastcat/factory_logger/issues/events{/number}","events_url":"https://api.github.com/repos/lastcat/factory_logger/events","assignees_url":"https://api.github.com/repos/lastcat/factory_logger/assignees{/user}","branches_url":"https://api.github.com/repos/lastcat/factory_logger/branches{/branch}","tags_url":"https://api.github.com/repos/lastcat/factory_logger/tags","blobs_url":"https://api.github.com/repos/lastcat/factory_logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lastcat/factory_logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lastcat/factory_logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/lastcat/factory_logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lastcat/factory_logger/statuses/{sha}","languages_url":"https://api.github.com/repos/lastcat/factory_logger/languages","stargazers_url":"https://api.github.com/repos/lastcat/factory_logger/stargazers","contributors_url":"https://api.github.com/repos/lastcat/factory_logger/contributors","subscribers_url":"https://api.github.com/repos/lastcat/factory_logger/subscribers","subscription_url":"https://api.github.com/repos/lastcat/factory_logger/subscription","commits_url":"https://api.github.com/repos/lastcat/factory_logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/lastcat/factory_logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/lastcat/factory_logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/lastcat/factory_logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/lastcat/factory_logger/contents/{+path}","compare_url":"https://api.github.com/repos/lastcat/factory_logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lastcat/factory_logger/merges","archive_url":"https://api.github.com/repos/lastcat/factory_logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lastcat/factory_logger/downloads","issues_url":"https://api.github.com/repos/lastcat/factory_logger/issues{/number}","pulls_url":"https://api.github.com/repos/lastcat/factory_logger/pulls{/number}","milestones_url":"https://api.github.com/repos/lastcat/factory_logger/milestones{/number}","notifications_url":"https://api.github.com/repos/lastcat/factory_logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lastcat/factory_logger/labels{/name}","releases_url":"https://api.github.com/repos/lastcat/factory_logger/releases{/id}","created_at":"2015-05-25T07:52:39Z","updated_at":"2015-05-25T07:53:34Z","pushed_at":"2015-06-02T09:23:22Z","git_url":"git://github.com/lastcat/factory_logger.git","ssh_url":"git@github.com:lastcat/factory_logger.git","clone_url":"https://github.com/lastcat/factory_logger.git","svn_url":"https://github.com/lastcat/factory_logger","homepage":null,"size":1196,"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":6,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lastcat/factory_logger/pulls/37"},"html":{"href":"https://github.com/lastcat/factory_logger/pull/37"},"issue":{"href":"https://api.github.com/repos/lastcat/factory_logger/issues/37"},"comments":{"href":"https://api.github.com/repos/lastcat/factory_logger/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/lastcat/factory_logger/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/lastcat/factory_logger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lastcat/factory_logger/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/lastcat/factory_logger/statuses/0cd14b376055162a40bad4935916ace2013b9170"}}}}