{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/149395948","pull_request_review_id":74781328,"id":149395948,"diff_hunk":"@@ -0,0 +1,15 @@\n+describe 'FactoryGirl' do\n+  local_models = Dir.glob('app/models/*.rb').map { |file| File.basename(file, '.rb').to_sym }\n+  factories = FactoryGirl.factories.collect(&:name)\n+\n+  ApplicationRecord.descendants.each do |klass|\n+    model = klass.name.underscore.to_sym\n+    next unless local_models.include?(model) # Skip non-locally defined models\n+\n+    context klass.name do","path":"spec/models/factory_girl_spec.rb","position":9,"original_position":9,"commit_id":"46ffe464b57b963ef2d7aaeb9e88ab072eaf7236","original_commit_id":"46ffe464b57b963ef2d7aaeb9e88ab072eaf7236","user":{"login":"skateman","id":649130,"avatar_url":"https://avatars1.githubusercontent.com/u/649130?v=4","gravatar_id":"","url":"https://api.github.com/users/skateman","html_url":"https://github.com/skateman","followers_url":"https://api.github.com/users/skateman/followers","following_url":"https://api.github.com/users/skateman/following{/other_user}","gists_url":"https://api.github.com/users/skateman/gists{/gist_id}","starred_url":"https://api.github.com/users/skateman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skateman/subscriptions","organizations_url":"https://api.github.com/users/skateman/orgs","repos_url":"https://api.github.com/users/skateman/repos","events_url":"https://api.github.com/users/skateman/events{/privacy}","received_events_url":"https://api.github.com/users/skateman/received_events","type":"User","site_admin":false},"body":"I already answered this here: https://github.com/ManageIQ/manageiq/pull/16404#discussion_r149298481","created_at":"2017-11-07T15:08:34Z","updated_at":"2017-11-07T15:08:35Z","html_url":"https://github.com/ManageIQ/manageiq/pull/16404#discussion_r149395948","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/149395948"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/16404#discussion_r149395948"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404"}},"in_reply_to_id":149391889},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404","id":150953444,"html_url":"https://github.com/ManageIQ/manageiq/pull/16404","diff_url":"https://github.com/ManageIQ/manageiq/pull/16404.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/16404.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/16404","number":16404,"state":"open","locked":false,"title":"Fail the CI if there are no factories for each locally defined model","user":{"login":"skateman","id":649130,"avatar_url":"https://avatars1.githubusercontent.com/u/649130?v=4","gravatar_id":"","url":"https://api.github.com/users/skateman","html_url":"https://github.com/skateman","followers_url":"https://api.github.com/users/skateman/followers","following_url":"https://api.github.com/users/skateman/following{/other_user}","gists_url":"https://api.github.com/users/skateman/gists{/gist_id}","starred_url":"https://api.github.com/users/skateman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skateman/subscriptions","organizations_url":"https://api.github.com/users/skateman/orgs","repos_url":"https://api.github.com/users/skateman/repos","events_url":"https://api.github.com/users/skateman/events{/privacy}","received_events_url":"https://api.github.com/users/skateman/received_events","type":"User","site_admin":false},"body":"**This PR is intentionally making Travis fail to demonstrate how it will react to missing/bad factories.**\r\n\r\nThe factories defined in this repo are being used elsewhere, [for example](https://github.com/ManageIQ/manageiq-ui-classic/pull/2613#discussion_r148969692) in the UI. However, it might happen that a model has no factory defined. In such case when writing tests it's necessary to create a core PR first. We were discussing with @martinpovolny how to ease this process and my proposal would be to **have at least an empty factory for each model defined in the core repo.**\r\n\r\nThis simple test checks all the direct descendants of `ApplicationRecord`, skipping all the models that aren't defined in the core repo. A test fails if there is no factory specified, and as a secondary feature, it will report a `pending` notification if the factory couldn't be built because of some other error. These errors are usually happening because the factory requires some extra arguments or a context.\r\n\r\nThe [first run](https://travis-ci.org/ManageIQ/manageiq/jobs/298189058) of Travis on this build will produce missing factory errors. The second build will run with a commit that adds the missing factories.","created_at":"2017-11-06T20:39:07Z","updated_at":"2017-11-07T15:08:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9cce94789c5351a61acddbd2c3ae3a0b4ab4c97","assignee":{"login":"chrisarcand","id":2430490,"avatar_url":"https://avatars2.githubusercontent.com/u/2430490?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisarcand","html_url":"https://github.com/chrisarcand","followers_url":"https://api.github.com/users/chrisarcand/followers","following_url":"https://api.github.com/users/chrisarcand/following{/other_user}","gists_url":"https://api.github.com/users/chrisarcand/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisarcand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisarcand/subscriptions","organizations_url":"https://api.github.com/users/chrisarcand/orgs","repos_url":"https://api.github.com/users/chrisarcand/repos","events_url":"https://api.github.com/users/chrisarcand/events{/privacy}","received_events_url":"https://api.github.com/users/chrisarcand/received_events","type":"User","site_admin":false},"assignees":[{"login":"chrisarcand","id":2430490,"avatar_url":"https://avatars2.githubusercontent.com/u/2430490?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisarcand","html_url":"https://github.com/chrisarcand","followers_url":"https://api.github.com/users/chrisarcand/followers","following_url":"https://api.github.com/users/chrisarcand/following{/other_user}","gists_url":"https://api.github.com/users/chrisarcand/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisarcand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisarcand/subscriptions","organizations_url":"https://api.github.com/users/chrisarcand/orgs","repos_url":"https://api.github.com/users/chrisarcand/repos","events_url":"https://api.github.com/users/chrisarcand/events{/privacy}","received_events_url":"https://api.github.com/users/chrisarcand/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/16404/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/46ffe464b57b963ef2d7aaeb9e88ab072eaf7236","head":{"label":"skateman:empty-factories","ref":"empty-factories","sha":"46ffe464b57b963ef2d7aaeb9e88ab072eaf7236","user":{"login":"skateman","id":649130,"avatar_url":"https://avatars1.githubusercontent.com/u/649130?v=4","gravatar_id":"","url":"https://api.github.com/users/skateman","html_url":"https://github.com/skateman","followers_url":"https://api.github.com/users/skateman/followers","following_url":"https://api.github.com/users/skateman/following{/other_user}","gists_url":"https://api.github.com/users/skateman/gists{/gist_id}","starred_url":"https://api.github.com/users/skateman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skateman/subscriptions","organizations_url":"https://api.github.com/users/skateman/orgs","repos_url":"https://api.github.com/users/skateman/repos","events_url":"https://api.github.com/users/skateman/events{/privacy}","received_events_url":"https://api.github.com/users/skateman/received_events","type":"User","site_admin":false},"repo":{"id":46090458,"name":"manageiq","full_name":"skateman/manageiq","owner":{"login":"skateman","id":649130,"avatar_url":"https://avatars1.githubusercontent.com/u/649130?v=4","gravatar_id":"","url":"https://api.github.com/users/skateman","html_url":"https://github.com/skateman","followers_url":"https://api.github.com/users/skateman/followers","following_url":"https://api.github.com/users/skateman/following{/other_user}","gists_url":"https://api.github.com/users/skateman/gists{/gist_id}","starred_url":"https://api.github.com/users/skateman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skateman/subscriptions","organizations_url":"https://api.github.com/users/skateman/orgs","repos_url":"https://api.github.com/users/skateman/repos","events_url":"https://api.github.com/users/skateman/events{/privacy}","received_events_url":"https://api.github.com/users/skateman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skateman/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/skateman/manageiq","forks_url":"https://api.github.com/repos/skateman/manageiq/forks","keys_url":"https://api.github.com/repos/skateman/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skateman/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skateman/manageiq/teams","hooks_url":"https://api.github.com/repos/skateman/manageiq/hooks","issue_events_url":"https://api.github.com/repos/skateman/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/skateman/manageiq/events","assignees_url":"https://api.github.com/repos/skateman/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/skateman/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/skateman/manageiq/tags","blobs_url":"https://api.github.com/repos/skateman/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skateman/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skateman/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/skateman/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skateman/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/skateman/manageiq/languages","stargazers_url":"https://api.github.com/repos/skateman/manageiq/stargazers","contributors_url":"https://api.github.com/repos/skateman/manageiq/contributors","subscribers_url":"https://api.github.com/repos/skateman/manageiq/subscribers","subscription_url":"https://api.github.com/repos/skateman/manageiq/subscription","commits_url":"https://api.github.com/repos/skateman/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/skateman/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/skateman/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/skateman/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/skateman/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/skateman/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skateman/manageiq/merges","archive_url":"https://api.github.com/repos/skateman/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skateman/manageiq/downloads","issues_url":"https://api.github.com/repos/skateman/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/skateman/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/skateman/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/skateman/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skateman/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/skateman/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/skateman/manageiq/deployments","created_at":"2015-11-13T00:51:43Z","updated_at":"2016-01-11T10:38:05Z","pushed_at":"2017-11-07T09:32:12Z","git_url":"git://github.com/skateman/manageiq.git","ssh_url":"git@github.com:skateman/manageiq.git","clone_url":"https://github.com/skateman/manageiq.git","svn_url":"https://github.com/skateman/manageiq","homepage":"manageiq.org","size":194849,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"380b87815ae0019e895e5373fb93c7de75fceb91","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars0.githubusercontent.com/u/1125575?v=4","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":20789757,"name":"manageiq","full_name":"ManageIQ/manageiq","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars0.githubusercontent.com/u/1125575?v=4","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/manageiq","description":"ManageIQ Open-Source Management Platform","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq","forks_url":"https://api.github.com/repos/ManageIQ/manageiq/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq/deployments","created_at":"2014-06-13T02:31:26Z","updated_at":"2017-11-06T18:26:36Z","pushed_at":"2017-11-07T14:52:52Z","git_url":"git://github.com/ManageIQ/manageiq.git","ssh_url":"git@github.com:ManageIQ/manageiq.git","clone_url":"https://github.com/ManageIQ/manageiq.git","svn_url":"https://github.com/ManageIQ/manageiq","homepage":"manageiq.org","size":213130,"stargazers_count":553,"watchers_count":553,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":537,"mirror_url":null,"archived":false,"open_issues_count":643,"forks":537,"open_issues":643,"watchers":553,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/16404"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/16404"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/16404/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/16404/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/46ffe464b57b963ef2d7aaeb9e88ab072eaf7236"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"skateman"}}