Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit cdd5b3a

Browse files
committed
Updated github client to return reset_time in UTC
1 parent 80a76c8 commit cdd5b3a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

app/lib/git_hub/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def check_rate_limit(response)
118118
def reset_time(response)
119119
seconds = response.headers['X-RateLimit-Reset'].to_i
120120

121-
Time.at(seconds).strftime '%-m/%d/%Y at%l:%M:%S%P %Z'
121+
Time.at(seconds).utc.strftime '%-m/%d/%Y at%l:%M:%S%P %Z'
122122
end
123123
end
124124
end

test/requests/git_hub/client_test.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,10 @@ def test_rate_limit_presence
134134
response = VCR.use_cassette('git_hub/commits/successful') do
135135
@client.commits_for(@oc, @pr_number, 1)
136136
end
137-
138-
reset_time = Time.at(1503866476).strftime '%-m/%d/%Y at%l:%M:%S%P %Z'
139-
137+
140138
assert_equal '57', response.headers['X-RateLimit-Remaining']
141139
assert_equal '60', response.headers['X-RateLimit-Limit']
142140
assert_equal '1503866476', response.headers['X-RateLimit-Reset']
143-
assert_equal reset_time, @client.send(:reset_time, response)
141+
assert_equal '8/27/2017 at 8:41:16pm UTC', @client.send(:reset_time, response)
144142
end
145143
end

0 commit comments

Comments
 (0)