stormpath-sdk 1.0.0.beta.6 → 1.0.0.beta.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.travis.yml +2 -0
  2. data/CHANGES.md +10 -0
  3. data/lib/stormpath-sdk.rb +15 -0
  4. data/lib/stormpath-sdk/data_store.rb +30 -14
  5. data/lib/stormpath-sdk/http/request.rb +5 -25
  6. data/lib/stormpath-sdk/http/response.rb +0 -5
  7. data/lib/stormpath-sdk/provider/account_access.rb +28 -0
  8. data/lib/stormpath-sdk/provider/account_request.rb +30 -0
  9. data/lib/stormpath-sdk/provider/account_resolver.rb +43 -0
  10. data/lib/stormpath-sdk/provider/account_result.rb +27 -0
  11. data/lib/stormpath-sdk/provider/facebook/facebook_provider.rb +18 -0
  12. data/lib/stormpath-sdk/provider/facebook/facebook_provider_data.rb +18 -0
  13. data/lib/stormpath-sdk/provider/google/google_provider.rb +18 -0
  14. data/lib/stormpath-sdk/provider/google/google_provider_data.rb +19 -0
  15. data/lib/stormpath-sdk/provider/provider.rb +18 -0
  16. data/lib/stormpath-sdk/provider/provider_data.rb +18 -0
  17. data/lib/stormpath-sdk/provider/stormpath/stormpath_provider.rb +17 -0
  18. data/lib/stormpath-sdk/provider/stormpath/stormpath_provider_data.rb +17 -0
  19. data/lib/stormpath-sdk/resource/account.rb +15 -0
  20. data/lib/stormpath-sdk/resource/application.rb +5 -2
  21. data/lib/stormpath-sdk/resource/associations.rb +7 -5
  22. data/lib/stormpath-sdk/resource/directory.rb +15 -0
  23. data/lib/stormpath-sdk/version.rb +2 -2
  24. data/spec/auth/basic_authenticator_spec.rb +5 -5
  25. data/spec/cache/cache_entry_spec.rb +3 -3
  26. data/spec/client_spec.rb +27 -20
  27. data/spec/provider/account_resolver_spec.rb +25 -0
  28. data/spec/provider/provider_spec.rb +152 -0
  29. data/spec/resource/account_spec.rb +26 -30
  30. data/spec/resource/account_store_mapping_spec.rb +28 -27
  31. data/spec/resource/account_store_spec.rb +7 -7
  32. data/spec/resource/application_spec.rb +34 -26
  33. data/spec/resource/collection_spec.rb +34 -34
  34. data/spec/resource/custom_data_spec.rb +2 -2
  35. data/spec/resource/directory_spec.rb +25 -23
  36. data/spec/resource/group_membership_spec.rb +3 -3
  37. data/spec/resource/group_spec.rb +16 -17
  38. data/spec/resource/status_spec.rb +16 -16
  39. data/spec/resource/tenant_spec.rb +10 -8
  40. data/spec/spec_helper.rb +37 -18
  41. data/spec/support/custom_data_storage_behavior.rb +19 -19
  42. data/spec/support/mocked_provider_accounts.rb +72 -0
  43. data/stormpath-sdk.gemspec +5 -9
  44. metadata +104 -111
  45. checksums.yaml +0 -7
@@ -6,7 +6,7 @@ describe Stormpath::Resource::CustomData, :vcr do
6
6
  end
7
7
 
8
8
  context 'wuth caching regions' do
9
- let(:directory) { test_api_client.directories.create name: 'test_directory' }
9
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
10
10
 
11
11
  it_behaves_like 'account_custom_data'
12
12
  it_behaves_like 'group_custom_data'
@@ -17,7 +17,7 @@ describe Stormpath::Resource::CustomData, :vcr do
17
17
  @disabled_cache_client ||= Stormpath::Client.new({api_key: test_api_key, cache: { store: Stormpath::Cache::DisabledCacheStore }})
18
18
  end
19
19
 
20
- let(:directory) { disabled_cache_client.directories.create name: 'test_directory' }
20
+ let(:directory) { disabled_cache_client.directories.create name: random_directory_name }
21
21
 
22
22
  it_behaves_like 'account_custom_data'
23
23
  it_behaves_like 'group_custom_data'
@@ -3,22 +3,24 @@ require 'spec_helper'
3
3
  describe Stormpath::Resource::Directory, :vcr do
4
4
 
5
5
  describe "instances should respond to attribute property methods" do
6
- subject(:directory) { test_api_client.directories.create name: 'some_test_directory', description: 'description_for_some_test_directory' }
6
+ let(:directory) { test_api_client.directories.create name: random_directory_name, description: 'description_for_some_test_directory' }
7
7
 
8
- it { should be_instance_of Stormpath::Resource::Directory }
9
-
10
- [:name, :description, :status].each do |property_accessor|
11
- it { should respond_to property_accessor }
12
- it { should respond_to "#{property_accessor}="}
13
- its(property_accessor) { should be_instance_of String }
8
+ after do
9
+ directory.delete if directory
14
10
  end
15
11
 
16
- its(:tenant) { should be_instance_of Stormpath::Resource::Tenant }
17
- its(:groups) { should be_instance_of Stormpath::Resource::Collection }
18
- its(:accounts) { should be_instance_of Stormpath::Resource::Collection }
12
+ it do
13
+ expect(directory).to be_a Stormpath::Resource::Directory
19
14
 
20
- after do
21
- directory.delete if directory
15
+ [:name, :description, :status].each do |property_accessor|
16
+ expect(directory).to respond_to(property_accessor)
17
+ expect(directory).to respond_to("#{property_accessor}=")
18
+ expect(directory.send property_accessor).to be_a String
19
+ end
20
+
21
+ expect(directory.tenant).to be_a Stormpath::Resource::Tenant
22
+ expect(directory.groups).to be_a Stormpath::Resource::Collection
23
+ expect(directory.accounts).to be_a Stormpath::Resource::Collection
22
24
  end
23
25
  end
24
26
 
@@ -42,7 +44,7 @@ describe Stormpath::Resource::Directory, :vcr do
42
44
  end
43
45
 
44
46
  context '#groups' do
45
- let(:group) { directory.groups.create name: "test_group"}
47
+ let(:group) { directory.groups.create name: random_group_name }
46
48
 
47
49
  after do
48
50
  group.delete if group
@@ -64,11 +66,11 @@ describe Stormpath::Resource::Directory, :vcr do
64
66
 
65
67
  let(:account) do
66
68
  Stormpath::Resource::Account.new({
67
- email: "test@example.com",
69
+ email: random_email,
68
70
  given_name: 'Ruby SDK',
69
71
  password: 'P@$$w0rd',
70
72
  surname: 'SDK',
71
- username: "username"
73
+ username: random_user_name
72
74
  })
73
75
  end
74
76
 
@@ -130,11 +132,11 @@ describe Stormpath::Resource::Directory, :vcr do
130
132
 
131
133
  it 'creates an account with custom data' do
132
134
  account = Stormpath::Resource::Account.new({
133
- email: "test@example.com",
135
+ email: random_email,
134
136
  given_name: 'Ruby SDK',
135
137
  password: 'P@$$w0rd',
136
138
  surname: 'SDK',
137
- username: "username"
139
+ username: random_user_name
138
140
  })
139
141
 
140
142
  account.custom_data["birth_date"] = "2305-07-13"
@@ -170,9 +172,9 @@ describe Stormpath::Resource::Directory, :vcr do
170
172
 
171
173
  describe '#delete_directory' do
172
174
 
173
- let(:directory) { test_api_client.directories.create name: 'test_directory' }
175
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
174
176
 
175
- let(:application) { test_api_client.applications.create name: 'test_application' }
177
+ let(:application) { test_api_client.applications.create name: random_application_name }
176
178
 
177
179
  let!(:group) { directory.groups.create name: 'someGroup' }
178
180
 
@@ -187,19 +189,19 @@ describe Stormpath::Resource::Directory, :vcr do
187
189
  end
188
190
 
189
191
  it 'and all of its associations' do
190
- expect(directory.groups).to have(1).item
191
- expect(directory.accounts).to have(1).item
192
+ expect(directory.groups.count).to eq(1)
193
+ expect(directory.accounts.count).to eq(1)
192
194
 
193
195
  expect(application.account_store_mappings.first.account_store).to eq(directory)
194
196
 
195
197
  expect(application.accounts).to include(account)
196
198
  expect(application.groups).to include(group)
197
199
 
198
- expect(application.account_store_mappings).to have(1).item
200
+ expect(application.account_store_mappings.count).to eq(1)
199
201
 
200
202
  directory.delete
201
203
 
202
- expect(application.account_store_mappings).to have(0).item
204
+ expect(application.account_store_mappings.count).to eq(0)
203
205
 
204
206
  expect(application.accounts).not_to include(account)
205
207
  expect(application.groups).not_to include(group)
@@ -8,7 +8,7 @@ describe Stormpath::Resource::GroupMembership, :vcr do
8
8
  describe '#add_account' do
9
9
  context "given an account and a group" do
10
10
 
11
- let(:directory) { test_api_client.directories.create name: 'testDirectory' }
11
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
12
12
 
13
13
  let(:group) { directory.groups.create name: 'someGroup' }
14
14
 
@@ -23,8 +23,8 @@ describe Stormpath::Resource::GroupMembership, :vcr do
23
23
  end
24
24
 
25
25
  it ", group membership and account membership should correspond to each other" do
26
- expect(group.account_memberships).to have(1).item
27
- expect(account.group_memberships).to have(1).item
26
+ expect(group.account_memberships.count).to eq(1)
27
+ expect(account.group_memberships.count).to eq(1)
28
28
  expect(group.accounts).to include(account)
29
29
  expect(account.groups).to include(group)
30
30
  expect(group.account_memberships.first).to be_a(Stormpath::Resource::GroupMembership)
@@ -5,32 +5,31 @@ describe Stormpath::Resource::Group, :vcr do
5
5
  describe "instances should respond to attribute property methods" do
6
6
  let(:directory) { test_directory }
7
7
 
8
- subject(:group) { directory.groups.create name: 'someTestGroup', description: 'someTestDescription' }
9
-
10
- [:name, :description, :status].each do |property_accessor|
11
- it { should respond_to property_accessor }
12
- it { should respond_to "#{property_accessor}="}
13
- its(property_accessor) { should be_instance_of String }
14
- end
15
-
16
- its(:tenant) { should be_instance_of Stormpath::Resource::Tenant }
17
- its(:directory) { should be_instance_of Stormpath::Resource::Directory }
18
- its(:custom_data) { should be_instance_of Stormpath::Resource::CustomData }
19
-
20
- its(:accounts) { should be_instance_of Stormpath::Resource::Collection }
21
- its(:account_memberships) { should be_instance_of Stormpath::Resource::Collection}
22
-
8
+ let(:group) { directory.groups.create name: 'someTestGroup', description: 'someTestDescription' }
23
9
 
24
10
  after do
25
11
  group.delete if group
26
12
  end
27
13
 
14
+ it do
15
+ [:name, :description, :status].each do |property_accessor|
16
+ expect(group).to respond_to(property_accessor)
17
+ expect(group).to respond_to("#{property_accessor}=")
18
+ expect(group.send property_accessor).to be_a String
19
+ end
20
+
21
+ expect(group.tenant).to be_a Stormpath::Resource::Tenant
22
+ expect(group.directory).to be_a Stormpath::Resource::Directory
23
+ expect(group.custom_data).to be_a Stormpath::Resource::CustomData
24
+ expect(group.accounts).to be_a Stormpath::Resource::Collection
25
+ expect(group.account_memberships).to be_a Stormpath::Resource::Collection
26
+ end
28
27
  end
29
28
 
30
29
  describe '#add_or_remove_account' do
31
30
  context "given an account" do
32
31
 
33
- let(:directory) { test_api_client.directories.create name: 'testDirectory' }
32
+ let(:directory) { test_api_client.directories.create name: random_directory_name }
34
33
 
35
34
  let(:group) { directory.groups.create name: 'someGroup' }
36
35
 
@@ -51,7 +50,7 @@ describe Stormpath::Resource::Group, :vcr do
51
50
  end
52
51
 
53
52
  it 'has one account membership resource' do
54
- expect(group.account_memberships).to have(1).item
53
+ expect(group.account_memberships.count).to eq(1)
55
54
  end
56
55
 
57
56
  it 'adds and removes the group from the account' do
@@ -1,17 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Stormpath::Resource::Status, :vcr do
4
-
4
+
5
5
  def authenticate_user
6
6
  auth_request = Stormpath::Authentication::UsernamePasswordRequest.new 'test@example.com', 'P@$$w0rd'
7
7
  account_store_mapping unless account_store_mapping
8
8
  application.authenticate_account auth_request
9
9
  end
10
10
 
11
- let(:directory) { test_api_client.directories.create name: 'testDirectory', description: 'testDirectory' }
11
+ let(:directory) { test_api_client.directories.create name: random_directory_name, description: 'testDirectory for statuses' }
12
+
13
+ let(:application) { test_api_client.applications.create name: random_application_name, description: 'testDirectory for statuses' }
12
14
 
13
- let(:application) { test_api_client.applications.create name: 'testApplication', description: 'testApplication' }
14
-
15
15
  let(:group) { directory.groups.create name: 'testGroup', description: 'testGroup' }
16
16
 
17
17
  let(:account_store_mapping) { test_api_client.account_store_mappings.create application: application, account_store: directory }
@@ -28,25 +28,25 @@ describe Stormpath::Resource::Status, :vcr do
28
28
  application.delete if application
29
29
  directory.delete if directory
30
30
  end
31
-
31
+
32
32
  it "should respond to status getter and setter" do
33
- expect(directory.respond_to? :status).to be_true
34
- expect(directory.respond_to? :status=).to be_true
33
+ expect(directory.respond_to? :status).to be_truthy
34
+ expect(directory.respond_to? :status=).to be_truthy
35
35
 
36
- expect(application.respond_to? :status).to be_true
37
- expect(application.respond_to? :status=).to be_true
38
-
39
- expect(group.respond_to? :status).to be_true
40
- expect(group.respond_to? :status=).to be_true
36
+ expect(application.respond_to? :status).to be_truthy
37
+ expect(application.respond_to? :status=).to be_truthy
41
38
 
42
- expect(account.respond_to? :status).to be_true
43
- expect(account.respond_to? :status=).to be_true
39
+ expect(group.respond_to? :status).to be_truthy
40
+ expect(group.respond_to? :status=).to be_truthy
41
+
42
+ expect(account.respond_to? :status).to be_truthy
43
+ expect(account.respond_to? :status=).to be_truthy
44
44
  end
45
45
 
46
46
  it "compare status hashes" do
47
47
  expect(directory.status_hash).to eq(status_hash)
48
48
  expect(application.status_hash).to eq(status_hash)
49
-
49
+
50
50
  expect(group.status_hash).to eq(status_hash)
51
51
  expect(account.status_hash).to eq(account_status_hash)
52
52
  end
@@ -60,7 +60,7 @@ describe Stormpath::Resource::Status, :vcr do
60
60
  account.save
61
61
  expect(reloaded_account.status).to eq("DISABLED")
62
62
  end
63
-
63
+
64
64
  it "authenticate user with status ENABLED" do
65
65
  expect(authenticate_user.properties["account"]["href"]).to eq(account.href)
66
66
  end
@@ -3,17 +3,19 @@ require 'spec_helper'
3
3
  describe Stormpath::Resource::Tenant, :vcr do
4
4
 
5
5
  describe "instances should respond to attribute property methods" do
6
- subject(:tenant) { test_api_client.tenant }
6
+ let(:tenant) { test_api_client.tenant }
7
7
 
8
- it { should be_instance_of Stormpath::Resource::Tenant }
8
+ it do
9
+ expect(tenant).to be_a Stormpath::Resource::Tenant
9
10
 
10
- [:name, :key].each do |property_accessor|
11
- it { should respond_to property_accessor }
12
- its(property_accessor) { should be_instance_of String }
13
- end
11
+ [:name, :key].each do |property_accessor|
12
+ expect(tenant).to respond_to(property_accessor)
13
+ expect(tenant.send property_accessor).to be_a String
14
+ end
14
15
 
15
- its(:applications) { should be_instance_of Stormpath::Resource::Collection }
16
- its(:directories) { should be_instance_of Stormpath::Resource::Collection }
16
+ expect(tenant.applications).to be_a Stormpath::Resource::Collection
17
+ expect(tenant.directories).to be_a Stormpath::Resource::Collection
18
+ end
17
19
  end
18
20
 
19
21
  end
data/spec/spec_helper.rb CHANGED
@@ -6,10 +6,8 @@ SimpleCov.start
6
6
 
7
7
  require 'stormpath-sdk'
8
8
  require 'pry'
9
- require 'pry-debugger'
10
9
  require 'webmock/rspec'
11
10
  require 'vcr'
12
- require_relative '../support/api.rb'
13
11
 
14
12
  Dir['./spec/support/*.rb'].each { |file| require file }
15
13
 
@@ -24,6 +22,12 @@ VCR.configure do |c|
24
22
  c.ignore_request { |r| HIJACK_HTTP_REQUESTS_WITH_VCR == false }
25
23
  end
26
24
 
25
+ RSpec::Matchers.define :be_boolean do
26
+ match do |actual|
27
+ actual.should satisfy { |x| x == true || x == false }
28
+ end
29
+ end
30
+
27
31
  module Stormpath
28
32
  module TestApiKeyHelpers
29
33
  TEST_ENV_REQUIRED_VARS = {
@@ -87,23 +91,44 @@ module Stormpath
87
91
  end
88
92
 
89
93
  module TestResourceHelpers
90
- def destroy_all_stormpath_test_resources
91
- Stormpath::Support::Api.destroy_resources(
92
- test_api_key_id, test_api_key_secret, test_application_url,
93
- test_directory_url, test_directory_with_verification_url
94
- )
95
- end
96
-
97
94
  def build_account(opts={})
98
95
  opts.tap do |o|
99
96
  o[:surname] = (!opts[:surname].blank? && opts[:surname]) || 'surname'
100
97
  o[:given_name] = (!opts[:given_name].blank? && opts[:given_name]) || 'givenname'
101
- o[:username] = (!opts[:username].blank? && opts[:username]) || 'username'
98
+ o[:username] = (!opts[:username].blank? && opts[:username]) || random_user_name
102
99
  o[:password] = (!opts[:password].blank? && opts[:password]) || 'P@$$w0rd'
103
- o[:email] = (!opts[:email].blank? && opts[:email]) || 'test@example.com'
100
+ o[:email] = (!opts[:email].blank? && opts[:email]) || random_email
104
101
  end
105
102
  end
106
103
  end
104
+
105
+ module RandomResourceNameGenerator
106
+ include UUIDTools
107
+
108
+ %w(application directory group user).each do |resource|
109
+ define_method "random_#{resource}_name" do |suffix=nil|
110
+ "#{random_string}_#{resource}_#{suffix}"
111
+ end
112
+ end
113
+
114
+ def random_email
115
+ "#{random_string}@stormpath.com"
116
+ end
117
+
118
+ def random_string
119
+ if HIJACK_HTTP_REQUESTS_WITH_VCR
120
+ 'test'
121
+ else
122
+ UUID.method(:random_create).call.to_s[0..9]
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ RSpec::Matchers.define :be_boolean do
129
+ match do |actual|
130
+ actual == true || actual == false
131
+ end
107
132
  end
108
133
 
109
134
  RSpec.configure do |c|
@@ -117,8 +142,7 @@ RSpec.configure do |c|
117
142
 
118
143
  c.include Stormpath::TestApiKeyHelpers
119
144
  c.include Stormpath::TestResourceHelpers
120
-
121
- c.treat_symbols_as_metadata_keys_with_true_values = true
145
+ c.include Stormpath::RandomResourceNameGenerator
122
146
 
123
147
  c.before(:all) do
124
148
  unless test_missing_env_vars.empty?
@@ -129,11 +153,6 @@ RSpec.configure do |c|
129
153
  set_up_message << "\nBe sure to configure these before running the specs again."
130
154
  raise set_up_message
131
155
  end
132
-
133
- destroy_all_stormpath_test_resources unless HIJACK_HTTP_REQUESTS_WITH_VCR
134
156
  end
135
157
 
136
- c.after(:all) do
137
- destroy_all_stormpath_test_resources unless HIJACK_HTTP_REQUESTS_WITH_VCR
138
- end
139
158
  end
@@ -1,16 +1,16 @@
1
1
  shared_examples_for 'account_custom_data' do
2
2
  context 'account' do
3
3
  let(:custom_data_storage) do
4
- directory.accounts.create username: "jlpicard",
5
- email: "capt@enterprise.com",
4
+ directory.accounts.create username: random_user_name,
5
+ email: random_email,
6
6
  givenName: "Jean-Luc",
7
7
  surname: "Picard",
8
8
  password: "uGhd%a8Kl!"
9
9
  end
10
10
 
11
11
  let(:custom_data_storage_w_nested_custom_data) do
12
- directory.accounts.create username: "jlpicard",
13
- email: "capt@enterprise.com",
12
+ directory.accounts.create username: random_user_name,
13
+ email: random_email,
14
14
  given_name: "Jean-Luc",
15
15
  surname: "Picard",
16
16
  password: "uGhd%a8Kl!",
@@ -36,11 +36,11 @@ end
36
36
  shared_examples_for 'group_custom_data' do
37
37
  context 'group' do
38
38
  let(:custom_data_storage) do
39
- directory.groups.create name: 'test_group'
39
+ directory.groups.create name: random_group_name
40
40
  end
41
41
 
42
42
  let(:custom_data_storage_w_nested_custom_data) do
43
- directory.groups.create name: "Jean",
43
+ directory.groups.create name: random_group_name,
44
44
  description: "Capital Group",
45
45
  custom_data: {
46
46
  rank: "Captain",
@@ -266,7 +266,7 @@ shared_examples_for 'custom_data_storage' do
266
266
  custom_data_storage.custom_data[:rank] = "Captain"
267
267
  custom_data_storage.custom_data["favorite_drink"] = "Earl Grey Tea"
268
268
  custom_data_storage.custom_data.save
269
-
269
+
270
270
  custom_data_storage.custom_data.delete(:rank)
271
271
  custom_data_storage.custom_data.save
272
272
 
@@ -277,19 +277,19 @@ shared_examples_for 'custom_data_storage' do
277
277
 
278
278
 
279
279
  it '#has_key?' do
280
- expect(custom_data_storage.custom_data.has_key? "createdAt").to be_true
281
- expect(custom_data_storage.custom_data.has_key? "created_at").not_to be_true
280
+ expect(custom_data_storage.custom_data.has_key? "createdAt").to be_truthy
281
+ expect(custom_data_storage.custom_data.has_key? "created_at").to be_falsey
282
282
  end
283
283
 
284
284
  it '#include?' do
285
- expect(custom_data_storage.custom_data.include? "createdAt").to be_true
286
- expect(custom_data_storage.custom_data.include? "created_at").not_to be_true
285
+ expect(custom_data_storage.custom_data.include? "createdAt").to be_truthy
286
+ expect(custom_data_storage.custom_data.include? "created_at").to be_falsey
287
287
  end
288
288
 
289
289
  it '#has_value?' do
290
290
  custom_data_storage.custom_data[:rank] = "Captain"
291
291
  custom_data_storage.custom_data.save
292
- expect(reloaded_custom_data_storage.custom_data.has_value? "Captain").to be_true
292
+ expect(reloaded_custom_data_storage.custom_data.has_value? "Captain").to be_truthy
293
293
  end
294
294
 
295
295
  it '#store' do
@@ -336,7 +336,7 @@ shared_examples_for 'custom_data_storage' do
336
336
 
337
337
  it '#keys' do
338
338
  expect(custom_data_storage.custom_data.keys).to be_kind_of(Array)
339
- expect(custom_data_storage.custom_data.keys).to have_at_least(3).items
339
+ expect(custom_data_storage.custom_data.keys.count).to eq(3)
340
340
  expect(custom_data_storage.custom_data.keys).to eq(custom_data_storage.custom_data.properties.keys)
341
341
  end
342
342
 
@@ -348,7 +348,7 @@ shared_examples_for 'custom_data_storage' do
348
348
  end
349
349
 
350
350
  it 'inner property holders clearing properly' do
351
- expect(deleted_properties).to have(0).items
351
+ expect(deleted_properties.count).to eq(0)
352
352
 
353
353
  custom_data_storage.custom_data[:permissions] = 'NOOP'
354
354
 
@@ -358,12 +358,12 @@ shared_examples_for 'custom_data_storage' do
358
358
  custom_data_storage.custom_data.delete(:permissions)
359
359
  expect(custom_data_storage.custom_data[:permissions]).to be_nil
360
360
 
361
- expect(deleted_properties).to have(1).items
361
+ expect(deleted_properties.count).to eq(1)
362
362
 
363
363
  custom_data_storage.custom_data.save
364
364
 
365
365
  expect(custom_data_storage.custom_data[:permissions]).to be_nil
366
- expect(deleted_properties).to have(0).items
366
+ expect(deleted_properties.count).to eq(0)
367
367
 
368
368
  custom_data_storage.custom_data[:permissions] = 'NOOP'
369
369
  expect(custom_data_storage.custom_data[:permissions]).to eq("NOOP")
@@ -371,18 +371,18 @@ shared_examples_for 'custom_data_storage' do
371
371
  custom_data_storage.custom_data.delete(:permissions)
372
372
  expect(custom_data_storage.custom_data[:permissions]).to be_nil
373
373
 
374
- expect(deleted_properties).to have(1).items
374
+ expect(deleted_properties.count).to eq(1)
375
375
 
376
376
  if custom_data_storage.is_a? Stormpath::Resource::Account
377
377
  custom_data_storage.given_name = "Capt"
378
378
  else
379
- custom_data_storage.name = "Capt"
379
+ custom_data_storage.name = random_group_name
380
380
  end
381
381
 
382
382
  custom_data_storage.save
383
383
 
384
384
  expect(custom_data_storage.custom_data[:permissions]).to be_nil
385
- expect(deleted_properties).to have(0).items
385
+ expect(deleted_properties.count).to eq(0)
386
386
  end
387
387
 
388
388
  def deleted_properties