From f2ce432fc9d8b184484633dcf09de2569c9d6cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nemanja=20=C4=8Corlija?= Date: Wed, 29 Sep 2021 02:13:22 +0200 Subject: [PATCH] Fix attr assignment in OAuth::RateLimitExceeded (#547) --- lib/xeroizer/oauth.rb | 2 +- test/unit/http_test.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/xeroizer/oauth.rb b/lib/xeroizer/oauth.rb index fe31a72fd..e9b960a5a 100644 --- a/lib/xeroizer/oauth.rb +++ b/lib/xeroizer/oauth.rb @@ -37,7 +37,7 @@ def initialize(description, retry_after: nil, daily_limit_remaining: nil) super(description) @retry_after = retry_after - @daily_limit_remaining = @daily_limit_remaining + @daily_limit_remaining = daily_limit_remaining end attr_reader :retry_after, :daily_limit_remaining diff --git a/test/unit/http_test.rb b/test/unit/http_test.rb index 696b0b43f..98075d968 100644 --- a/test/unit/http_test.rb +++ b/test/unit/http_test.rb @@ -180,6 +180,8 @@ class HttpTest < UnitTestCase assert_match /rate limit exceeded/i, error.message assert_match /328 requests left for the day/i, error.message assert_match /42 seconds until you can make another request/i, error.message + assert_equal 42, error.retry_after + assert_equal 328, error.daily_limit_remaining end end end