{"action":"created","comment":{"url":"https://api.github.com/repos/tablexi/restforce-db/pulls/comments/29684441","id":29684441,"diff_hunk":"@@ -0,0 +1,60 @@\n+require_relative \"../../../test_helper\"\n+\n+describe Restforce::DB::RunnerCache do\n+\n+  configure!\n+  mappings!\n+\n+  let(:cache) { Restforce::DB::RunnerCache.new }\n+\n+  describe \"#collection\" do\n+    let(:object) { mapping.database_model.create! }\n+\n+    before { object }\n+\n+    it \"invokes the specified collection for the mapping\" do\n+      instances = cache.collection(mapping, :database_record_type)\n+      expect(instances.first.record).to_equal object\n+    end\n+\n+    describe \"on repeated calls for the same mapping\" do\n+      let(:dummy_collection) do\n+        Object.new.tap do |collection|\n+\n+          def collection.values\n+            [1, 2, 3]\n+          end\n+\n+          def collection.each(*_)\n+            values.each { |i| yield i }\n+          end\n+        end\n+      end\n+\n+      before do\n+        cache.collection(mapping, :database_record_type) { next }","path":"test/lib/restforce/db/runner_cache_test.rb","position":35,"original_position":35,"commit_id":"bea1501becd8fdf90cc38e5a24b950cd05cf00f5","original_commit_id":"bea1501becd8fdf90cc38e5a24b950cd05cf00f5","user":{"login":"danhodos","id":10109,"avatar_url":"https://avatars.githubusercontent.com/u/10109?v=3","gravatar_id":"","url":"https://api.github.com/users/danhodos","html_url":"https://github.com/danhodos","followers_url":"https://api.github.com/users/danhodos/followers","following_url":"https://api.github.com/users/danhodos/following{/other_user}","gists_url":"https://api.github.com/users/danhodos/gists{/gist_id}","starred_url":"https://api.github.com/users/danhodos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danhodos/subscriptions","organizations_url":"https://api.github.com/users/danhodos/orgs","repos_url":"https://api.github.com/users/danhodos/repos","events_url":"https://api.github.com/users/danhodos/events{/privacy}","received_events_url":"https://api.github.com/users/danhodos/received_events","type":"User","site_admin":false},"body":"What is this `{ next }` block? It doesn't seem like `RunnerCache#collection` takes a block?","created_at":"2015-05-05T16:09:14Z","updated_at":"2015-05-05T16:09:14Z","html_url":"https://github.com/tablexi/restforce-db/pull/18#discussion_r29684441","pull_request_url":"https://api.github.com/repos/tablexi/restforce-db/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/tablexi/restforce-db/pulls/comments/29684441"},"html":{"href":"https://github.com/tablexi/restforce-db/pull/18#discussion_r29684441"},"pull_request":{"href":"https://api.github.com/repos/tablexi/restforce-db/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/tablexi/restforce-db/pulls/18","id":34673412,"html_url":"https://github.com/tablexi/restforce-db/pull/18","diff_url":"https://github.com/tablexi/restforce-db/pull/18.diff","patch_url":"https://github.com/tablexi/restforce-db/pull/18.patch","issue_url":"https://api.github.com/repos/tablexi/restforce-db/issues/18","number":18,"state":"open","locked":false,"title":"Cache instances for query results during a run","user":{"login":"ahorner","id":116396,"avatar_url":"https://avatars.githubusercontent.com/u/116396?v=3","gravatar_id":"","url":"https://api.github.com/users/ahorner","html_url":"https://github.com/ahorner","followers_url":"https://api.github.com/users/ahorner/followers","following_url":"https://api.github.com/users/ahorner/following{/other_user}","gists_url":"https://api.github.com/users/ahorner/gists{/gist_id}","starred_url":"https://api.github.com/users/ahorner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahorner/subscriptions","organizations_url":"https://api.github.com/users/ahorner/orgs","repos_url":"https://api.github.com/users/ahorner/repos","events_url":"https://api.github.com/users/ahorner/events{/privacy}","received_events_url":"https://api.github.com/users/ahorner/received_events","type":"User","site_admin":false},"body":"We’ve introduced RunnerCache, an interstitial object which Runner \r\nconsults to fetch its collections of Salesforce and database instances.\r\nThis abstracts out record fetching, and allows us to cache the instances\r\nfor the duration of a run, ensuring that we’re working with consistent\r\ndata.\r\n\r\nWhile introducing this object, we’ve modified `#salesforce_instances` \r\nand `#database_instances` to return a generic Enumerator, rather than\r\nforcing a specific block syntax on the classes which invoke these \r\nmethods.","created_at":"2015-05-04T20:47:01Z","updated_at":"2015-05-05T16:09:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f0a687913f84b490e32882d6ae7831168e60c51","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tablexi/restforce-db/pulls/18/commits","review_comments_url":"https://api.github.com/repos/tablexi/restforce-db/pulls/18/comments","review_comment_url":"https://api.github.com/repos/tablexi/restforce-db/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tablexi/restforce-db/issues/18/comments","statuses_url":"https://api.github.com/repos/tablexi/restforce-db/statuses/bea1501becd8fdf90cc38e5a24b950cd05cf00f5","head":{"label":"tablexi:cache_instance_queries","ref":"cache_instance_queries","sha":"bea1501becd8fdf90cc38e5a24b950cd05cf00f5","user":{"login":"tablexi","id":229702,"avatar_url":"https://avatars.githubusercontent.com/u/229702?v=3","gravatar_id":"","url":"https://api.github.com/users/tablexi","html_url":"https://github.com/tablexi","followers_url":"https://api.github.com/users/tablexi/followers","following_url":"https://api.github.com/users/tablexi/following{/other_user}","gists_url":"https://api.github.com/users/tablexi/gists{/gist_id}","starred_url":"https://api.github.com/users/tablexi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tablexi/subscriptions","organizations_url":"https://api.github.com/users/tablexi/orgs","repos_url":"https://api.github.com/users/tablexi/repos","events_url":"https://api.github.com/users/tablexi/events{/privacy}","received_events_url":"https://api.github.com/users/tablexi/received_events","type":"Organization","site_admin":false},"repo":{"id":32425520,"name":"restforce-db","full_name":"tablexi/restforce-db","owner":{"login":"tablexi","id":229702,"avatar_url":"https://avatars.githubusercontent.com/u/229702?v=3","gravatar_id":"","url":"https://api.github.com/users/tablexi","html_url":"https://github.com/tablexi","followers_url":"https://api.github.com/users/tablexi/followers","following_url":"https://api.github.com/users/tablexi/following{/other_user}","gists_url":"https://api.github.com/users/tablexi/gists{/gist_id}","starred_url":"https://api.github.com/users/tablexi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tablexi/subscriptions","organizations_url":"https://api.github.com/users/tablexi/orgs","repos_url":"https://api.github.com/users/tablexi/repos","events_url":"https://api.github.com/users/tablexi/events{/privacy}","received_events_url":"https://api.github.com/users/tablexi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tablexi/restforce-db","description":"Bind your database to Salesforce data","fork":false,"url":"https://api.github.com/repos/tablexi/restforce-db","forks_url":"https://api.github.com/repos/tablexi/restforce-db/forks","keys_url":"https://api.github.com/repos/tablexi/restforce-db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tablexi/restforce-db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tablexi/restforce-db/teams","hooks_url":"https://api.github.com/repos/tablexi/restforce-db/hooks","issue_events_url":"https://api.github.com/repos/tablexi/restforce-db/issues/events{/number}","events_url":"https://api.github.com/repos/tablexi/restforce-db/events","assignees_url":"https://api.github.com/repos/tablexi/restforce-db/assignees{/user}","branches_url":"https://api.github.com/repos/tablexi/restforce-db/branches{/branch}","tags_url":"https://api.github.com/repos/tablexi/restforce-db/tags","blobs_url":"https://api.github.com/repos/tablexi/restforce-db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tablexi/restforce-db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tablexi/restforce-db/git/refs{/sha}","trees_url":"https://api.github.com/repos/tablexi/restforce-db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tablexi/restforce-db/statuses/{sha}","languages_url":"https://api.github.com/repos/tablexi/restforce-db/languages","stargazers_url":"https://api.github.com/repos/tablexi/restforce-db/stargazers","contributors_url":"https://api.github.com/repos/tablexi/restforce-db/contributors","subscribers_url":"https://api.github.com/repos/tablexi/restforce-db/subscribers","subscription_url":"https://api.github.com/repos/tablexi/restforce-db/subscription","commits_url":"https://api.github.com/repos/tablexi/restforce-db/commits{/sha}","git_commits_url":"https://api.github.com/repos/tablexi/restforce-db/git/commits{/sha}","comments_url":"https://api.github.com/repos/tablexi/restforce-db/comments{/number}","issue_comment_url":"https://api.github.com/repos/tablexi/restforce-db/issues/comments{/number}","contents_url":"https://api.github.com/repos/tablexi/restforce-db/contents/{+path}","compare_url":"https://api.github.com/repos/tablexi/restforce-db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tablexi/restforce-db/merges","archive_url":"https://api.github.com/repos/tablexi/restforce-db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tablexi/restforce-db/downloads","issues_url":"https://api.github.com/repos/tablexi/restforce-db/issues{/number}","pulls_url":"https://api.github.com/repos/tablexi/restforce-db/pulls{/number}","milestones_url":"https://api.github.com/repos/tablexi/restforce-db/milestones{/number}","notifications_url":"https://api.github.com/repos/tablexi/restforce-db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tablexi/restforce-db/labels{/name}","releases_url":"https://api.github.com/repos/tablexi/restforce-db/releases{/id}","created_at":"2015-03-17T23:04:27Z","updated_at":"2015-05-04T20:18:03Z","pushed_at":"2015-05-04T20:47:01Z","git_url":"git://github.com/tablexi/restforce-db.git","ssh_url":"git@github.com:tablexi/restforce-db.git","clone_url":"https://github.com/tablexi/restforce-db.git","svn_url":"https://github.com/tablexi/restforce-db","homepage":null,"size":885,"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":"tablexi:master","ref":"master","sha":"8f6253595d4bd5192b40ce5092f5369774d27736","user":{"login":"tablexi","id":229702,"avatar_url":"https://avatars.githubusercontent.com/u/229702?v=3","gravatar_id":"","url":"https://api.github.com/users/tablexi","html_url":"https://github.com/tablexi","followers_url":"https://api.github.com/users/tablexi/followers","following_url":"https://api.github.com/users/tablexi/following{/other_user}","gists_url":"https://api.github.com/users/tablexi/gists{/gist_id}","starred_url":"https://api.github.com/users/tablexi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tablexi/subscriptions","organizations_url":"https://api.github.com/users/tablexi/orgs","repos_url":"https://api.github.com/users/tablexi/repos","events_url":"https://api.github.com/users/tablexi/events{/privacy}","received_events_url":"https://api.github.com/users/tablexi/received_events","type":"Organization","site_admin":false},"repo":{"id":32425520,"name":"restforce-db","full_name":"tablexi/restforce-db","owner":{"login":"tablexi","id":229702,"avatar_url":"https://avatars.githubusercontent.com/u/229702?v=3","gravatar_id":"","url":"https://api.github.com/users/tablexi","html_url":"https://github.com/tablexi","followers_url":"https://api.github.com/users/tablexi/followers","following_url":"https://api.github.com/users/tablexi/following{/other_user}","gists_url":"https://api.github.com/users/tablexi/gists{/gist_id}","starred_url":"https://api.github.com/users/tablexi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tablexi/subscriptions","organizations_url":"https://api.github.com/users/tablexi/orgs","repos_url":"https://api.github.com/users/tablexi/repos","events_url":"https://api.github.com/users/tablexi/events{/privacy}","received_events_url":"https://api.github.com/users/tablexi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tablexi/restforce-db","description":"Bind your database to Salesforce data","fork":false,"url":"https://api.github.com/repos/tablexi/restforce-db","forks_url":"https://api.github.com/repos/tablexi/restforce-db/forks","keys_url":"https://api.github.com/repos/tablexi/restforce-db/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tablexi/restforce-db/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tablexi/restforce-db/teams","hooks_url":"https://api.github.com/repos/tablexi/restforce-db/hooks","issue_events_url":"https://api.github.com/repos/tablexi/restforce-db/issues/events{/number}","events_url":"https://api.github.com/repos/tablexi/restforce-db/events","assignees_url":"https://api.github.com/repos/tablexi/restforce-db/assignees{/user}","branches_url":"https://api.github.com/repos/tablexi/restforce-db/branches{/branch}","tags_url":"https://api.github.com/repos/tablexi/restforce-db/tags","blobs_url":"https://api.github.com/repos/tablexi/restforce-db/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tablexi/restforce-db/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tablexi/restforce-db/git/refs{/sha}","trees_url":"https://api.github.com/repos/tablexi/restforce-db/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tablexi/restforce-db/statuses/{sha}","languages_url":"https://api.github.com/repos/tablexi/restforce-db/languages","stargazers_url":"https://api.github.com/repos/tablexi/restforce-db/stargazers","contributors_url":"https://api.github.com/repos/tablexi/restforce-db/contributors","subscribers_url":"https://api.github.com/repos/tablexi/restforce-db/subscribers","subscription_url":"https://api.github.com/repos/tablexi/restforce-db/subscription","commits_url":"https://api.github.com/repos/tablexi/restforce-db/commits{/sha}","git_commits_url":"https://api.github.com/repos/tablexi/restforce-db/git/commits{/sha}","comments_url":"https://api.github.com/repos/tablexi/restforce-db/comments{/number}","issue_comment_url":"https://api.github.com/repos/tablexi/restforce-db/issues/comments{/number}","contents_url":"https://api.github.com/repos/tablexi/restforce-db/contents/{+path}","compare_url":"https://api.github.com/repos/tablexi/restforce-db/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tablexi/restforce-db/merges","archive_url":"https://api.github.com/repos/tablexi/restforce-db/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tablexi/restforce-db/downloads","issues_url":"https://api.github.com/repos/tablexi/restforce-db/issues{/number}","pulls_url":"https://api.github.com/repos/tablexi/restforce-db/pulls{/number}","milestones_url":"https://api.github.com/repos/tablexi/restforce-db/milestones{/number}","notifications_url":"https://api.github.com/repos/tablexi/restforce-db/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tablexi/restforce-db/labels{/name}","releases_url":"https://api.github.com/repos/tablexi/restforce-db/releases{/id}","created_at":"2015-03-17T23:04:27Z","updated_at":"2015-05-04T20:18:03Z","pushed_at":"2015-05-04T20:47:01Z","git_url":"git://github.com/tablexi/restforce-db.git","ssh_url":"git@github.com:tablexi/restforce-db.git","clone_url":"https://github.com/tablexi/restforce-db.git","svn_url":"https://github.com/tablexi/restforce-db","homepage":null,"size":885,"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/tablexi/restforce-db/pulls/18"},"html":{"href":"https://github.com/tablexi/restforce-db/pull/18"},"issue":{"href":"https://api.github.com/repos/tablexi/restforce-db/issues/18"},"comments":{"href":"https://api.github.com/repos/tablexi/restforce-db/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/tablexi/restforce-db/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/tablexi/restforce-db/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tablexi/restforce-db/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/tablexi/restforce-db/statuses/bea1501becd8fdf90cc38e5a24b950cd05cf00f5"}}}}