{"action":"created","comment":{"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/comments/33882414","id":33882414,"diff_hunk":"@@ -514,4 +514,106 @@ def country\n       end\n     end\n   end\n+\n+  context 'qualified with #allow_nil' do\n+    context 'when using delegate from rails' do\n+      context 'when delegate call allows nil' do\n+        it 'accepts' do\n+          define_class('Person') do\n+            delegate :hello, to: :country, allow_nil: true\n+            def country; end\n+          end\n+\n+          person = Person.new\n+          expect(person).to delegate_method(:hello).to(:country).allow_nil\n+        end\n+      end\n+\n+      context 'when delegate call does not allow nil' do\n+        it 'rejects with the correct failure message' do\n+          define_class('Person') do\n+            delegate :hello, to: :country\n+            def country; end\n+          end\n+\n+          message = [\n+            'Expected Person to delegate #hello to #country object allowing nil',\n+            'Method calls sent to Person#country:'\n+          ].join(\"\\n\")\n+\n+          person = Person.new\n+\n+          expect {\n+            expect(person).to delegate_method(:hello).to(:country).allow_nil\n+          }.to fail_including(message)\n+        end\n+      end\n+    end\n+    context 'when using Forwardable' do\n+      context 'when delegate object is nil' do\n+        it 'rejects with the correct failure message' do\n+          define_class('Person') do\n+            extend Forwardable\n+\n+            def_delegators :country, :hello\n+\n+            def country; end\n+          end\n+\n+          message = [\n+            'Expected Person to delegate #hello to #country object allowing nil',\n+            'Method calls sent to Person#country:',\n+            '1) hello()'\n+          ].join(\"\\n\")\n+\n+          person = Person.new\n+\n+          expect {\n+            expect(person).to delegate_method(:hello).to(:country).allow_nil\n+          }.to fail_with_message(message)\n+        end\n+      end\n+    end\n+    context 'when using methods' do\n+      context 'when supports nil delegate object' do\n+        it 'accepts' do\n+          define_class('Person') do\n+            def country; end\n+\n+            def hello\n+              return unless country\n+              country.hello\n+            end\n+          end\n+\n+          person = Person.new\n+          expect(person).to delegate_method(:hello).to(:country).allow_nil\n+        end\n+      end\n+\n+      context 'when does not supports nil delegate object' do\n+        it 'rejects with the correct failure message' do\n+          define_class('Person') do\n+            def country; end\n+\n+            def hello\n+              country.hello\n+            end\n+          end\n+\n+          message = [\n+            'Expected Person to delegate #hello to #country object allowing nil',","path":"spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb","position":92,"original_position":92,"commit_id":"c92a6f17a78e3e8980603e288c1b9ac89b7b1844","original_commit_id":"c92a6f17a78e3e8980603e288c1b9ac89b7b1844","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":"Line is too long. [81/80]","created_at":"2015-07-03T22:42:45Z","updated_at":"2015-07-03T22:42:45Z","html_url":"https://github.com/thoughtbot/shoulda-matchers/pull/751#discussion_r33882414","pull_request_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751","_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/comments/33882414"},"html":{"href":"https://github.com/thoughtbot/shoulda-matchers/pull/751#discussion_r33882414"},"pull_request":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751"}}},"pull_request":{"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751","id":39198542,"html_url":"https://github.com/thoughtbot/shoulda-matchers/pull/751","diff_url":"https://github.com/thoughtbot/shoulda-matchers/pull/751.diff","patch_url":"https://github.com/thoughtbot/shoulda-matchers/pull/751.patch","issue_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/751","number":751,"state":"open","locked":false,"title":"Adding support to allow_nil option for delegate_method matcher","user":{"login":"alejandrogutierrez","id":1541261,"avatar_url":"https://avatars.githubusercontent.com/u/1541261?v=3","gravatar_id":"","url":"https://api.github.com/users/alejandrogutierrez","html_url":"https://github.com/alejandrogutierrez","followers_url":"https://api.github.com/users/alejandrogutierrez/followers","following_url":"https://api.github.com/users/alejandrogutierrez/following{/other_user}","gists_url":"https://api.github.com/users/alejandrogutierrez/gists{/gist_id}","starred_url":"https://api.github.com/users/alejandrogutierrez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alejandrogutierrez/subscriptions","organizations_url":"https://api.github.com/users/alejandrogutierrez/orgs","repos_url":"https://api.github.com/users/alejandrogutierrez/repos","events_url":"https://api.github.com/users/alejandrogutierrez/events{/privacy}","received_events_url":"https://api.github.com/users/alejandrogutierrez/received_events","type":"User","site_admin":false},"body":"Hi everyone! I would like to add support for allow_nil option to delegate_method matcher.\r\n```ruby\r\nit { should delegate_method(:deliver).to(:post_office).allow_nil(true) }\r\n```\r\nI update rspec-rails version in Appraisals file in order to get some new matchers.","created_at":"2015-07-03T22:42:39Z","updated_at":"2015-07-03T22:42:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83a5651776d21ea25f548326d88e20e56932b6b2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751/commits","review_comments_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751/comments","review_comment_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/751/comments","statuses_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/statuses/c92a6f17a78e3e8980603e288c1b9ac89b7b1844","head":{"label":"alejandrogutierrez:feature/delegate_method-allow_nil","ref":"feature/delegate_method-allow_nil","sha":"c92a6f17a78e3e8980603e288c1b9ac89b7b1844","user":{"login":"alejandrogutierrez","id":1541261,"avatar_url":"https://avatars.githubusercontent.com/u/1541261?v=3","gravatar_id":"","url":"https://api.github.com/users/alejandrogutierrez","html_url":"https://github.com/alejandrogutierrez","followers_url":"https://api.github.com/users/alejandrogutierrez/followers","following_url":"https://api.github.com/users/alejandrogutierrez/following{/other_user}","gists_url":"https://api.github.com/users/alejandrogutierrez/gists{/gist_id}","starred_url":"https://api.github.com/users/alejandrogutierrez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alejandrogutierrez/subscriptions","organizations_url":"https://api.github.com/users/alejandrogutierrez/orgs","repos_url":"https://api.github.com/users/alejandrogutierrez/repos","events_url":"https://api.github.com/users/alejandrogutierrez/events{/privacy}","received_events_url":"https://api.github.com/users/alejandrogutierrez/received_events","type":"User","site_admin":false},"repo":{"id":38459659,"name":"shoulda-matchers","full_name":"alejandrogutierrez/shoulda-matchers","owner":{"login":"alejandrogutierrez","id":1541261,"avatar_url":"https://avatars.githubusercontent.com/u/1541261?v=3","gravatar_id":"","url":"https://api.github.com/users/alejandrogutierrez","html_url":"https://github.com/alejandrogutierrez","followers_url":"https://api.github.com/users/alejandrogutierrez/followers","following_url":"https://api.github.com/users/alejandrogutierrez/following{/other_user}","gists_url":"https://api.github.com/users/alejandrogutierrez/gists{/gist_id}","starred_url":"https://api.github.com/users/alejandrogutierrez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alejandrogutierrez/subscriptions","organizations_url":"https://api.github.com/users/alejandrogutierrez/orgs","repos_url":"https://api.github.com/users/alejandrogutierrez/repos","events_url":"https://api.github.com/users/alejandrogutierrez/events{/privacy}","received_events_url":"https://api.github.com/users/alejandrogutierrez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alejandrogutierrez/shoulda-matchers","description":"Collection of testing matchers extracted from Shoulda","fork":true,"url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers","forks_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/forks","keys_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/teams","hooks_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/hooks","issue_events_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/issues/events{/number}","events_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/events","assignees_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/assignees{/user}","branches_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/branches{/branch}","tags_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/tags","blobs_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/git/refs{/sha}","trees_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/statuses/{sha}","languages_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/languages","stargazers_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/stargazers","contributors_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/contributors","subscribers_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/subscribers","subscription_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/subscription","commits_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/commits{/sha}","git_commits_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/git/commits{/sha}","comments_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/comments{/number}","issue_comment_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/issues/comments{/number}","contents_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/contents/{+path}","compare_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/merges","archive_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/downloads","issues_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/issues{/number}","pulls_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/pulls{/number}","milestones_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/milestones{/number}","notifications_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/labels{/name}","releases_url":"https://api.github.com/repos/alejandrogutierrez/shoulda-matchers/releases{/id}","created_at":"2015-07-02T22:20:12Z","updated_at":"2015-07-02T22:20:13Z","pushed_at":"2015-07-03T22:39:34Z","git_url":"git://github.com/alejandrogutierrez/shoulda-matchers.git","ssh_url":"git@github.com:alejandrogutierrez/shoulda-matchers.git","clone_url":"https://github.com/alejandrogutierrez/shoulda-matchers.git","svn_url":"https://github.com/alejandrogutierrez/shoulda-matchers","homepage":"http://matchers.shoulda.io","size":12697,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"thoughtbot:master","ref":"master","sha":"a3fb06c369c2b5e96831cb2c6c8532de8e2f0e62","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":1172597,"name":"shoulda-matchers","full_name":"thoughtbot/shoulda-matchers","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/shoulda-matchers","description":"Collection of testing matchers extracted from Shoulda","fork":false,"url":"https://api.github.com/repos/thoughtbot/shoulda-matchers","forks_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/forks","keys_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/teams","hooks_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/events","assignees_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/tags","blobs_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/subscription","commits_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/comments{/number}","contents_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/merges","archive_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/downloads","issues_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/shoulda-matchers/releases{/id}","created_at":"2010-12-15T22:41:52Z","updated_at":"2015-07-02T21:24:32Z","pushed_at":"2015-07-03T22:42:39Z","git_url":"git://github.com/thoughtbot/shoulda-matchers.git","ssh_url":"git@github.com:thoughtbot/shoulda-matchers.git","clone_url":"https://github.com/thoughtbot/shoulda-matchers.git","svn_url":"https://github.com/thoughtbot/shoulda-matchers","homepage":"http://matchers.shoulda.io","size":17652,"stargazers_count":1252,"watchers_count":1252,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":362,"mirror_url":null,"open_issues_count":53,"forks":362,"open_issues":53,"watchers":1252,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751"},"html":{"href":"https://github.com/thoughtbot/shoulda-matchers/pull/751"},"issue":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/751"},"comments":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/issues/751/comments"},"review_comments":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751/comments"},"review_comment":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/pulls/751/commits"},"statuses":{"href":"https://api.github.com/repos/thoughtbot/shoulda-matchers/statuses/c92a6f17a78e3e8980603e288c1b9ac89b7b1844"}}}}