omniauth-applicaster 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0ac378a39c598eb3656c8065628155e0b61bfde
4
- data.tar.gz: 765f8acd6f8fac276beb05d58c91c218e64dc1d1
3
+ metadata.gz: 6945c3ae7d17b5590097a6a467a13234a2705355
4
+ data.tar.gz: 208431d82e39cc7d9de00343062b119a4a7f2b88
5
5
  SHA512:
6
- metadata.gz: 0486f7b9d14805c576d94ed13bc0bf84b26714123316360fc8bfb6473bfc2257b0ebb9f86169b486b38294f698c0cdc180e413004dba5fef5f3b73538ba562c4
7
- data.tar.gz: 5d932c806d173728e1a389700b55e21253bb4566d65f99194933ea10da974890bd0e9c0605b402f54731de59f05c567bb7941aff3cef26ff59b12ce83ecfe7a8
6
+ metadata.gz: 091d23f2dfdc715f35a7b5febf18a604c07dd2852b9c8ab94de2af4815745ceb7f90dc48e84402e273b54e9395b752bf707d228e245d9d3764d4f22044384788
7
+ data.tar.gz: c9286e01668134507bc8d3fafdceaf7ca8eb27013ee75d3349f47bc271188ebdcc61eb04c654c47fc09d935bce96fb9df782185682ebe11e36280ebf289b3cfd
@@ -103,6 +103,8 @@ module Applicaster
103
103
 
104
104
  def find_user_by_id(id)
105
105
  self.class.user_by_id_and_token(id, client_credentials_token.token)
106
+ rescue Faraday::ResourceNotFound
107
+ nil
106
108
  end
107
109
 
108
110
  def connection(*args)
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Applicaster
3
- VERSION = "1.6.0"
3
+ VERSION = "1.6.1"
4
4
  end
5
5
  end
@@ -191,16 +191,36 @@ RSpec.describe Applicaster::Accounts do
191
191
  end
192
192
 
193
193
  describe "#find_user_by_id" do
194
- let(:user_id) { 11 }
195
-
196
194
  before do
197
195
  stub_client_credentials_request
198
- stub_user_show_request(user_id, "client-credentials-token")
199
196
  end
200
197
 
201
- it "returns User object" do
202
- expect(accounts_service.find_user_by_id(user_id))
203
- .to be_kind_of(Applicaster::Accounts::User)
198
+ context "when accounts service returns 200" do
199
+ let(:user_id) { 11 }
200
+
201
+ before do
202
+ stub_user_show_request(user_id, "client-credentials-token")
203
+ end
204
+
205
+ it "returns User object" do
206
+ expect(accounts_service.find_user_by_id(user_id))
207
+ .to be_kind_of(Applicaster::Accounts::User)
208
+ end
209
+ end
210
+
211
+ context "when accounts service returns 404" do
212
+ let(:user_id) { "wrong-id" }
213
+
214
+ before do
215
+ stub_request(:get, "https://#{accounts_host}/api/v1/users/#{user_id}.json").
216
+ with(query: { access_token: "client-credentials-token" }).
217
+ to_return(status: 404, body: "")
218
+ end
219
+
220
+ it "doesn't raise" do
221
+ expect{ accounts_service.find_user_by_id(user_id) }
222
+ .to_not raise_error
223
+ end
204
224
  end
205
225
  end
206
226
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-applicaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neer Friedman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler