Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit aa6b97c

Browse files
committedSep 11, 2016
return PRs for every in ascending order
1 parent 48c7bc2 commit aa6b97c

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed
 

‎assets/lib/common.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def pulls_options(base: nil)
110110
end
111111

112112
def default_opts
113-
{ state: 'open', sort: 'updated', direction: 'desc' }
113+
{ state: 'open', sort: 'updated', direction: 'asc' }
114114
end
115115
end
116116

‎spec/integration/check_spec.rb

+12-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
must_stub_query_params
2424

2525
before do
26-
proxy.stub('https://api.github.com:443/repos/jtarchie/test/pulls?base=my-base-branch&direction=desc&per_page=100&sort=updated&state=open')
26+
proxy.stub('https://api.github.com:443/repos/jtarchie/test/pulls?base=my-base-branch&direction=asc&per_page=100&sort=updated&state=open')
2727
.and_return(json: [{ number: 1, head: { sha: 'abcdef' } }])
2828
end
2929

@@ -56,7 +56,7 @@
5656
must_stub_query_params
5757

5858
before do
59-
proxy.stub('https://api.github.com:443/repos/jtarchie/test/pulls?direction=desc&per_page=100&sort=updated&state=open')
59+
proxy.stub('https://api.github.com:443/repos/jtarchie/test/pulls?direction=asc&per_page=100&sort=updated&state=open')
6060
.and_return(json: [{ number: 1, head: { sha: 'abcdef' } }])
6161
end
6262

@@ -76,18 +76,20 @@
7676
end
7777

7878
context 'when there is more than one open pull request' do
79+
must_stub_query_params
80+
7981
before do
80-
proxy.stub('https://api.github.com:443/repos/jtarchie/test/pulls')
81-
.and_return(json: [
82-
{ number: 2, head: { sha: 'zyxwvu' } },
83-
{ number: 1, head: { sha: 'abcdef' } }
84-
])
82+
proxy.stub('https://api.github.com:443/repos/jtarchie/test/pulls?direction=asc&per_page=100&sort=updated&state=open')
83+
.and_return(json: [
84+
{ number: 1, head: { sha: 'abcdef' } },
85+
{ number: 2, head: { sha: 'zyxwvu' } }
86+
])
8587
end
8688

87-
it 'returns all the pull request SHAs' do
89+
it 'returns all PRs oldest to newest last' do
8890
expect(check(source: { repo: 'jtarchie/test', every: true }, version: {})).to eq [
89-
{ 'ref' => 'zyxwvu', 'pr' => '2' },
90-
{ 'ref' => 'abcdef', 'pr' => '1' }
91+
{ 'ref' => 'abcdef', 'pr' => '1' },
92+
{ 'ref' => 'zyxwvu', 'pr' => '2' }
9193
]
9294
end
9395
end

0 commit comments

Comments
 (0)
This repository has been archived.