aptible-auth 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f7d3b3449aa46547c72b239c8b45fbdd41f0c61
4
- data.tar.gz: 94e0c36a49c89fded1991e0a38cdd9662d8b8922
3
+ metadata.gz: ca4a9d2b5c68eb6a3bc594cf68004a13c3843b61
4
+ data.tar.gz: f0d1cb3b938429bdb1b6205c50fc29213e99cfd9
5
5
  SHA512:
6
- metadata.gz: 5346dbd8ffb771a0ec55e582ae3e4ca135e0d548595b8209b309efba555edb0f7d9f5b7ca32f3e8e3b841873a993bb82d8a386cf354d3597931dbbb1c86bb31b
7
- data.tar.gz: 0d5ba907bbf284012c559717832565a3f261c5bb975a337f71a6ca82e51f202cd0993fc6787e29463cab173af72e0d15842ebe6b583fd8a3b8b9016d3bf4720e
6
+ metadata.gz: 366eb12cc1b762232a46f846bf85f2aa5c8d4f38dd8462c0a3552e82876ab74c4cfef3f0f1e01f8f630866287640de4e6013c8742cc1e42411446c261209e764
7
+ data.tar.gz: c26709fb7730c6c2f195a5a82412111ad35ceffeb28212d429bc5b1e962efb640354f0a0d7d301ed37f694e8e967951b230f2dfcc7c8cc20800df599c1f69714
@@ -13,7 +13,7 @@ module Aptible
13
13
  field :updated_at, type: Time
14
14
 
15
15
  def organizations
16
- roles.map(&:organization)
16
+ roles.map(&:organization).uniq(&:id)
17
17
  end
18
18
 
19
19
  def operations
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Auth
3
- VERSION = '0.5.2'
3
+ VERSION = '0.5.3'
4
4
  end
5
5
  end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Aptible::Auth::User do
4
+ describe '#organizations' do
5
+ let(:so) { double 'Aptible::Auth::Role' }
6
+ let(:owner) { double 'Aptible::Auth::Role' }
7
+ let(:org) { double 'Aptible::Auth::Organization' }
8
+
9
+ before do
10
+ org.stub(:id) { 1 }
11
+ so.stub(:organization) { org }
12
+ owner.stub(:organization) { org }
13
+ end
14
+
15
+ it 'should return empty if no organizations' do
16
+ subject.stub(:roles) { [] }
17
+ expect(subject.organizations.count).to eq 0
18
+ end
19
+
20
+ it 'should return unique organizations only' do
21
+ subject.stub(:roles) { [so, owner] }
22
+ expect(subject.organizations.count).to eq 1
23
+ end
24
+
25
+ end
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aptible-resource
@@ -153,6 +153,7 @@ files:
153
153
  - spec/aptible/auth/organization_spec.rb
154
154
  - spec/aptible/auth/resource_spec.rb
155
155
  - spec/aptible/auth/token_spec.rb
156
+ - spec/aptible/auth/user_spec.rb
156
157
  - spec/aptible/auth_spec.rb
157
158
  - spec/shared/set_env.rb
158
159
  - spec/spec_helper.rb
@@ -185,6 +186,7 @@ test_files:
185
186
  - spec/aptible/auth/organization_spec.rb
186
187
  - spec/aptible/auth/resource_spec.rb
187
188
  - spec/aptible/auth/token_spec.rb
189
+ - spec/aptible/auth/user_spec.rb
188
190
  - spec/aptible/auth_spec.rb
189
191
  - spec/shared/set_env.rb
190
192
  - spec/spec_helper.rb