stormpath-sdk 0.4.0 → 1.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +27 -0
- data/CHANGES.md +21 -1
- data/Gemfile +1 -2
- data/README.md +457 -11
- data/Rakefile +15 -1
- data/lib/stormpath-sdk.rb +52 -33
- data/lib/stormpath-sdk/{resource/group_list.rb → api_key.rb} +5 -9
- data/lib/stormpath-sdk/auth/authentication_result.rb +3 -13
- data/lib/stormpath-sdk/auth/basic_authenticator.rb +5 -11
- data/lib/stormpath-sdk/auth/basic_login_attempt.rb +6 -8
- data/lib/stormpath-sdk/auth/username_password_request.rb +2 -5
- data/lib/stormpath-sdk/cache/cache.rb +54 -0
- data/lib/stormpath-sdk/cache/cache_entry.rb +33 -0
- data/lib/stormpath-sdk/cache/cache_manager.rb +22 -0
- data/lib/stormpath-sdk/cache/cache_stats.rb +35 -0
- data/lib/stormpath-sdk/cache/memory_store.rb +29 -0
- data/lib/stormpath-sdk/cache/redis_store.rb +32 -0
- data/lib/stormpath-sdk/client.rb +111 -0
- data/lib/stormpath-sdk/data_store.rb +241 -0
- data/lib/stormpath-sdk/{client/api_key.rb → error.rb} +16 -10
- data/lib/stormpath-sdk/{util → ext}/hash.rb +1 -2
- data/lib/stormpath-sdk/http/authc/sauthc1_signer.rb +8 -4
- data/lib/stormpath-sdk/http/http_client_request_executor.rb +8 -7
- data/lib/stormpath-sdk/http/request.rb +4 -8
- data/lib/stormpath-sdk/{util/request_utils.rb → http/utils.rb} +17 -38
- data/lib/stormpath-sdk/resource/account.rb +12 -108
- data/lib/stormpath-sdk/resource/application.rb +35 -171
- data/lib/stormpath-sdk/resource/associations.rb +97 -0
- data/lib/stormpath-sdk/resource/base.rb +256 -0
- data/lib/stormpath-sdk/resource/collection.rb +94 -0
- data/lib/stormpath-sdk/resource/directory.rb +11 -68
- data/lib/stormpath-sdk/resource/email_verification_token.rb +3 -9
- data/lib/stormpath-sdk/resource/error.rb +4 -38
- data/lib/stormpath-sdk/resource/expansion.rb +28 -0
- data/lib/stormpath-sdk/resource/group.rb +8 -66
- data/lib/stormpath-sdk/resource/group_membership.rb +4 -55
- data/lib/stormpath-sdk/resource/{application_list.rb → instance.rb} +7 -13
- data/lib/stormpath-sdk/resource/password_reset_token.rb +5 -23
- data/lib/stormpath-sdk/resource/status.rb +22 -28
- data/lib/stormpath-sdk/resource/tenant.rb +5 -52
- data/lib/stormpath-sdk/resource/utils.rb +43 -13
- data/lib/stormpath-sdk/util/assert.rb +5 -15
- data/lib/stormpath-sdk/version.rb +3 -3
- data/spec/api_key_spec.rb +19 -0
- data/spec/auth/basic_authenticator_spec.rb +25 -0
- data/spec/auth/sauthc1_signer_spec.rb +42 -0
- data/spec/cache/cache_entry_spec.rb +157 -0
- data/spec/cache/cache_spec.rb +89 -0
- data/spec/cache/cache_stats_spec.rb +106 -0
- data/spec/client_spec.rb +538 -0
- data/spec/data_store_spec.rb +130 -0
- data/spec/resource/account_spec.rb +74 -0
- data/spec/resource/application_spec.rb +148 -0
- data/spec/resource/base_spec.rb +114 -0
- data/spec/resource/collection_spec.rb +169 -0
- data/spec/resource/directory_spec.rb +30 -0
- data/spec/resource/expansion_spec.rb +100 -0
- data/spec/resource/group_spec.rb +49 -0
- data/spec/spec_helper.rb +135 -0
- data/spec/support/resource_factory.rb +48 -0
- data/spec/support/resource_matchers.rb +27 -0
- data/spec/support/test_cache_stores.rb +9 -0
- data/spec/support/test_request_executor.rb +11 -0
- data/stormpath-sdk.gemspec +14 -4
- data/support/api.rb +55 -0
- metadata +214 -44
- data/lib/stormpath-sdk/client/client.rb +0 -38
- data/lib/stormpath-sdk/client/client_application.rb +0 -38
- data/lib/stormpath-sdk/client/client_application_builder.rb +0 -351
- data/lib/stormpath-sdk/client/client_builder.rb +0 -305
- data/lib/stormpath-sdk/ds/data_store.rb +0 -210
- data/lib/stormpath-sdk/ds/resource_factory.rb +0 -37
- data/lib/stormpath-sdk/resource/account_list.rb +0 -32
- data/lib/stormpath-sdk/resource/collection_resource.rb +0 -91
- data/lib/stormpath-sdk/resource/directory_list.rb +0 -30
- data/lib/stormpath-sdk/resource/group_membership_list.rb +0 -32
- data/lib/stormpath-sdk/resource/instance_resource.rb +0 -28
- data/lib/stormpath-sdk/resource/resource.rb +0 -327
- data/lib/stormpath-sdk/resource/resource_error.rb +0 -47
- data/test/client/client.yml +0 -16
- data/test/client/client_application_builder_spec.rb +0 -114
- data/test/client/client_builder_spec.rb +0 -176
- data/test/client/read_spec.rb +0 -254
- data/test/client/write_spec.rb +0 -420
- data/test/resource/resource_spec.rb +0 -41
- data/test/resource/test_resource.rb +0 -28
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Stormpath::Resource::Collection do
|
4
|
+
let(:href) do
|
5
|
+
'http://example.com'
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:item_class) do
|
9
|
+
Stormpath::Resource::Application
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:client) do
|
13
|
+
Stormpath::Client
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#collection_href' do
|
17
|
+
context 'by default' do
|
18
|
+
let(:collection) do
|
19
|
+
Stormpath::Resource::Collection.new href, item_class, client
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'defaults to href' do
|
23
|
+
expect(collection.collection_href).to eq href
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when specified' do
|
28
|
+
let(:collection_href) do
|
29
|
+
'http://fakie.com'
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:collection) do
|
33
|
+
Stormpath::Resource::Collection.new(
|
34
|
+
href, item_class, client,
|
35
|
+
collection_href: collection_href
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'defaults to href' do
|
40
|
+
expect(collection.collection_href).to eq collection_href
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#offset' do
|
46
|
+
let(:collection) do
|
47
|
+
Stormpath::Resource::Collection.new href, item_class, client
|
48
|
+
end
|
49
|
+
|
50
|
+
let!(:offset) do
|
51
|
+
collection.offset 5
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'returns the collection' do
|
55
|
+
expect(offset.class).to eq Stormpath::Resource::Collection
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'adds the query to the criteria' do
|
59
|
+
expect(collection.criteria).to include offset: 5
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#limit' do
|
64
|
+
let(:collection) do
|
65
|
+
Stormpath::Resource::Collection.new href, item_class, client
|
66
|
+
end
|
67
|
+
|
68
|
+
let!(:limit) do
|
69
|
+
collection.limit 100
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'returns the collection' do
|
73
|
+
expect(limit.class).to eq Stormpath::Resource::Collection
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'adds the query param to the criteria' do
|
77
|
+
expect(collection.criteria).to include limit: 100
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '#order' do
|
82
|
+
let(:collection) do
|
83
|
+
Stormpath::Resource::Collection.new href, item_class, client
|
84
|
+
end
|
85
|
+
|
86
|
+
let(:order_statement) do
|
87
|
+
'lastName asc,age desc'
|
88
|
+
end
|
89
|
+
|
90
|
+
let!(:order) do
|
91
|
+
collection.order order_statement
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'returns the collection' do
|
95
|
+
expect(order.class).to eq Stormpath::Resource::Collection
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'adds the query param to the criteria' do
|
99
|
+
expect(collection.criteria).to include order_by: order_statement
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#search' do
|
104
|
+
let(:collection) do
|
105
|
+
Stormpath::Resource::Collection.new href, item_class, client
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'when passed a string' do
|
109
|
+
let(:query) do
|
110
|
+
'dagnabbit'
|
111
|
+
end
|
112
|
+
|
113
|
+
let!(:search) do
|
114
|
+
collection.search query
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'returns the collection' do
|
118
|
+
expect(search.class).to eq Stormpath::Resource::Collection
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'adds a "q" query string to the criteria' do
|
122
|
+
expect(collection.criteria).to include q: query
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'when passed a hash of attributes' do
|
127
|
+
let(:query_hash) do
|
128
|
+
{ name: 'Stanley Kubrick', description: 'That dude was a sick maniac' }
|
129
|
+
end
|
130
|
+
|
131
|
+
let!(:search) do
|
132
|
+
collection.search query_hash
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'returns the collection' do
|
136
|
+
expect(search.class).to eq Stormpath::Resource::Collection
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'adds a "q" query string to the criteria' do
|
140
|
+
expect(collection.criteria).to include query_hash
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe '#criteria' do
|
146
|
+
let(:collection) do
|
147
|
+
Stormpath::Resource::Collection.new href, item_class, client
|
148
|
+
end
|
149
|
+
|
150
|
+
context 'when no fetch criteria present' do
|
151
|
+
it 'returns an empty hash for criteria' do
|
152
|
+
expect(collection.criteria).to be_empty
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context 'when search, offset, limit and order by are chained' do
|
157
|
+
before do
|
158
|
+
collection.search('Big up to Brooklyn').order('lastName asc').offset(15).limit 50
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'has the search parameters' do
|
162
|
+
expect(collection.criteria).to include q: 'Big up to Brooklyn'
|
163
|
+
expect(collection.criteria).to include offset: 15
|
164
|
+
expect(collection.criteria).to include limit: 50
|
165
|
+
expect(collection.criteria).to include order_by: 'lastName asc'
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Stormpath::Resource::Directory, :vcr do
|
4
|
+
describe '#create_account' do
|
5
|
+
let(:directory) { test_directory }
|
6
|
+
|
7
|
+
context 'given a valid account' do
|
8
|
+
let(:account) do
|
9
|
+
Stormpath::Resource::Account.new({
|
10
|
+
email: "test@example.com",
|
11
|
+
given_name: 'Ruby SDK',
|
12
|
+
password: 'P@$$w0rd',
|
13
|
+
surname: 'SDK',
|
14
|
+
username: "username"
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:created_account) { directory.create_account account, false }
|
19
|
+
|
20
|
+
after do
|
21
|
+
created_account.delete if created_account
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'creates an account' do
|
25
|
+
expect(created_account).to be
|
26
|
+
expect(created_account.username).to eq(account.username)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Stormpath::Resource::Expansion, :vcr do
|
4
|
+
describe '#initialize' do
|
5
|
+
context 'given a single property name' do
|
6
|
+
let(:expansion) do
|
7
|
+
Stormpath::Resource::Expansion.new 'foo'
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'can be transmuted to a simple hash' do
|
11
|
+
expect(expansion.to_query).to eq({ expand: 'foo' })
|
12
|
+
end
|
13
|
+
end
|
14
|
+
context 'given a list of property names' do
|
15
|
+
let(:expansion) do
|
16
|
+
Stormpath::Resource::Expansion.new 'foo', 'bar'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'can be transmuted to a simple hash' do
|
20
|
+
expect(expansion.to_query).to eq({ expand: 'foo,bar' })
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'given no arguments are passed to constructor' do
|
25
|
+
let(:expansion) do
|
26
|
+
Stormpath::Resource::Expansion.new
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'will transmute to an empty hash' do
|
30
|
+
expect(expansion.to_query).to be_nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#add_property" do
|
36
|
+
context 'given a simple property name' do
|
37
|
+
let(:expansion) { Stormpath::Resource::Expansion.new }
|
38
|
+
|
39
|
+
before do
|
40
|
+
expansion.add_property :foo
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'can be transmuted to a simple hash' do
|
44
|
+
expect(expansion.to_query).to eq({ expand: 'foo' })
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'given two simple property names' do
|
49
|
+
let(:expansion) { Stormpath::Resource::Expansion.new }
|
50
|
+
|
51
|
+
before do
|
52
|
+
expansion.add_property :foo
|
53
|
+
expansion.add_property :bar
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'can be transmuted to a simple hash' do
|
57
|
+
expect(expansion.to_query).to eq({ expand: 'foo,bar' })
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'given a duplicate property name' do
|
62
|
+
let(:expansion) { Stormpath::Resource::Expansion.new }
|
63
|
+
|
64
|
+
before do
|
65
|
+
expansion.add_property :foo
|
66
|
+
expansion.add_property :bar
|
67
|
+
expansion.add_property :bar
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'will not duplicate the property' do
|
71
|
+
expect(expansion.to_query).to eq({ expand: 'foo,bar' })
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'given a property name, offset, and limit' do
|
76
|
+
let(:expansion) { Stormpath::Resource::Expansion.new }
|
77
|
+
|
78
|
+
before do
|
79
|
+
expansion.add_property :foo, offset: 5, limit: 100
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'can be transmuted to a simple hash' do
|
83
|
+
expect(expansion.to_query).to eq({ expand: 'foo(offset:5,limit:100)' })
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'given two calls to add the same property' do
|
88
|
+
let(:expansion) { Stormpath::Resource::Expansion.new }
|
89
|
+
|
90
|
+
before do
|
91
|
+
expansion.add_property :foo, offset: 5, limit: 100
|
92
|
+
expansion.add_property :foo, offset: 25
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'allows the last call to win out over the first' do
|
96
|
+
expect(expansion.to_query).to eq({ expand: 'foo(offset:25)' })
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Stormpath::Resource::Group, :vcr do
|
5
|
+
describe '#add_account' do
|
6
|
+
context "given an account" do
|
7
|
+
let(:directory) do
|
8
|
+
test_api_client.directories.create name: 'testDirectory'
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:group) do
|
12
|
+
directory.groups.create name: 'someGroup'
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:account) do
|
16
|
+
directory.accounts.create({
|
17
|
+
email: 'rubysdk@example.com',
|
18
|
+
given_name: 'Ruby SDK',
|
19
|
+
password: 'P@$$w0rd',
|
20
|
+
surname: 'SDK',
|
21
|
+
username: 'rubysdk'
|
22
|
+
})
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:reloaded_account) do
|
26
|
+
test_api_client.accounts.get account.href
|
27
|
+
end
|
28
|
+
|
29
|
+
let(:reloaded_group) do
|
30
|
+
test_api_client.groups.get group.href
|
31
|
+
end
|
32
|
+
|
33
|
+
before do
|
34
|
+
group.add_account account
|
35
|
+
end
|
36
|
+
|
37
|
+
after do
|
38
|
+
group.delete if group
|
39
|
+
directory.delete if directory
|
40
|
+
account.delete if account
|
41
|
+
end
|
42
|
+
|
43
|
+
it "adds the account to the group" do
|
44
|
+
found = reloaded_group.accounts.find { |a| a.href == account.href }
|
45
|
+
expect(found).to be
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
# Note: If SimpleCov starts after your application code is already loaded (via require),
|
2
|
+
# it won't be able to track your files and their coverage! The SimpleCov.start must be
|
3
|
+
# issued before any of your application code is required!
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start
|
6
|
+
|
7
|
+
require 'stormpath-sdk'
|
8
|
+
require 'pry'
|
9
|
+
require 'pry-debugger'
|
10
|
+
require 'webmock/rspec'
|
11
|
+
require 'vcr'
|
12
|
+
require_relative '../support/api.rb'
|
13
|
+
|
14
|
+
Dir['./spec/support/*.rb'].each { |file| require file }
|
15
|
+
|
16
|
+
HIJACK_HTTP_REQUESTS_WITH_VCR = ENV['STORMPATH_SDK_TEST_ENVIRONMENT'] != 'CI'
|
17
|
+
|
18
|
+
WebMock.allow_net_connect!
|
19
|
+
|
20
|
+
VCR.configure do |c|
|
21
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
22
|
+
c.hook_into :webmock
|
23
|
+
c.configure_rspec_metadata!
|
24
|
+
c.ignore_request { |r| HIJACK_HTTP_REQUESTS_WITH_VCR != true }
|
25
|
+
end
|
26
|
+
|
27
|
+
module Stormpath
|
28
|
+
module TestApiKeyHelpers
|
29
|
+
TEST_ENV_REQUIRED_VARS = {
|
30
|
+
STORMPATH_SDK_TEST_API_KEY_ID: 'The id form your Stormpath API Key',
|
31
|
+
STORMPATH_SDK_TEST_API_KEY_SECRET: 'The secret from your Stormpath API Key',
|
32
|
+
STORMPATH_SDK_TEST_APPLICATION_URL: 'The REST URL of a Stormpath Application reserved for testing.',
|
33
|
+
STORMPATH_SDK_TEST_DIRECTORY_URL: 'The REST URL of a Stormpath Directory associated to the test Application.',
|
34
|
+
STORMPATH_SDK_TEST_DIRECTORY_WITH_VERIFICATION_URL: 'The REST URL of a Stormpath Directory configured for email verification, associated to the test Application.'
|
35
|
+
}
|
36
|
+
|
37
|
+
def test_api_key_id
|
38
|
+
ENV['STORMPATH_SDK_TEST_API_KEY_ID']
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_api_key_secret
|
42
|
+
ENV['STORMPATH_SDK_TEST_API_KEY_SECRET']
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_directory_url
|
46
|
+
ENV['STORMPATH_SDK_TEST_DIRECTORY_URL']
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_directory_with_verification_url
|
50
|
+
ENV['STORMPATH_SDK_TEST_DIRECTORY_WITH_VERIFICATION_URL']
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_application_url
|
54
|
+
ENV['STORMPATH_SDK_TEST_APPLICATION_URL']
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_api_key
|
58
|
+
Stormpath::ApiKey.new test_api_key_id,
|
59
|
+
test_api_key_secret
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_api_client
|
63
|
+
Stormpath::Client.new api_key: test_api_key
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_missing_env_vars
|
67
|
+
TEST_ENV_REQUIRED_VARS.reject do |var, message|
|
68
|
+
ENV[var.to_s]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_application
|
73
|
+
test_api_client.applications.get test_application_url
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_directory
|
77
|
+
test_api_client.directories.get test_directory_url
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_directory_with_verification
|
81
|
+
test_api_client.directories.get test_directory_with_verification_url
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
module TestResourceHelpers
|
86
|
+
def destroy_all_stormpath_test_resources
|
87
|
+
Stormpath::Support::Api.destroy_resources(
|
88
|
+
test_api_key_id, test_api_key_secret, test_application_url,
|
89
|
+
test_directory_url, test_directory_with_verification_url
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
93
|
+
def build_account(opts={})
|
94
|
+
opts.tap do |o|
|
95
|
+
o[:surname] = (!opts[:surname].blank? && opts[:surname]) || 'surname'
|
96
|
+
o[:given_name] = (!opts[:given_name].blank? && opts[:given_name]) || 'givenname'
|
97
|
+
o[:username] = (!opts[:username].blank? && opts[:username]) || 'username'
|
98
|
+
o[:password] = (!opts[:password].blank? && opts[:password]) || 'P@$$w0rd'
|
99
|
+
o[:email] = (!opts[:email].blank? && opts[:email]) || 'test@example.com'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
RSpec.configure do |c|
|
106
|
+
c.mock_with :rspec do |c|
|
107
|
+
c.syntax = :expect
|
108
|
+
end
|
109
|
+
|
110
|
+
c.expect_with :rspec do |c|
|
111
|
+
c.syntax = :expect
|
112
|
+
end
|
113
|
+
|
114
|
+
c.include Stormpath::TestApiKeyHelpers
|
115
|
+
c.include Stormpath::TestResourceHelpers
|
116
|
+
|
117
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
118
|
+
|
119
|
+
c.before(:all) do
|
120
|
+
unless test_missing_env_vars.empty?
|
121
|
+
set_up_message = "In order to run the specs of the Stormpath SDK you need to setup the following environment variables:\n\t"
|
122
|
+
set_up_message << test_missing_env_vars.map do |var, message|
|
123
|
+
"#{var.to_s} : #{message}"
|
124
|
+
end.join("\n\t")
|
125
|
+
set_up_message << "\nBe sure to configure these before running the specs again."
|
126
|
+
raise set_up_message
|
127
|
+
end
|
128
|
+
|
129
|
+
destroy_all_stormpath_test_resources unless HIJACK_HTTP_REQUESTS_WITH_VCR
|
130
|
+
end
|
131
|
+
|
132
|
+
c.after(:all) do
|
133
|
+
destroy_all_stormpath_test_resources unless HIJACK_HTTP_REQUESTS_WITH_VCR
|
134
|
+
end
|
135
|
+
end
|