From 68cdb550f7b90318a136e4dd484249ab678f5fbc Mon Sep 17 00:00:00 2001 From: Ben Muschol Date: Mon, 14 Aug 2017 11:41:29 -0400 Subject: [PATCH] Spec for issues search --- Library/Homebrew/test/utils/github_spec.rb | 8 ++++++++ Library/Homebrew/utils/github.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/test/utils/github_spec.rb b/Library/Homebrew/test/utils/github_spec.rb index 5c315aec4a..80f0ef7861 100644 --- a/Library/Homebrew/test/utils/github_spec.rb +++ b/Library/Homebrew/test/utils/github_spec.rb @@ -28,4 +28,12 @@ describe GitHub do expect(query).to eq("q=user%3AHomebrew+user%3Acaskroom&per_page=100") end end + + describe "::issues_matching", :needs_network do + it "queries GitHub issues with the passed parameters" do + results = subject.issues_matching("brew search", repo: "Homebrew/brew", author: "avetamine", is: "closed") + expect(results.count).to eq(1) + expect(results.first["title"]).to eq("brew search : 422 Unprocessable Entity") + end + end end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 960b563d91..8096c7b9c4 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -266,7 +266,7 @@ module GitHub puts "Closed pull requests:" prs = open_or_closed_prs else - return + return [] end prs.each { |i| puts "#{i["title"]} (#{i["html_url"]})" }