scimitar 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ # Self-test. Sometimes tests call into utility methods in spec_helper.rb;
2
+ # if those aren't doing what they should, then the tests might give false
3
+ # positive passes.
4
+ #
5
+ require 'spec_helper'
6
+
7
+ RSpec.describe 'spec_helper.rb self-test' do
8
+ context '#spec_helper_hupcase' do
9
+ it 'converts a flat Hash, preserving data type of keys' do
10
+ input = {:one => 1, 'two' => 2}
11
+ output = spec_helper_hupcase(input)
12
+
13
+ expect(output).to eql({:ONE => 1, 'TWO' => 2})
14
+ end
15
+
16
+ it 'converts a nested Hash' do
17
+ input = {:one => 1, 'two' => {:tHrEe => {'fOuR' => 4}}}
18
+ output = spec_helper_hupcase(input)
19
+
20
+ expect(output).to eql({:ONE => 1, 'TWO' => {:THREE => {'FOUR' => 4}}})
21
+ end
22
+
23
+ it 'converts an Array with Hashes' do
24
+ input = {:one => 1, 'two' => [true, 42, {:tHrEe => {'fOuR' => 4}}]}
25
+ output = spec_helper_hupcase(input)
26
+
27
+ expect(output).to eql({:ONE => 1, 'TWO' => [true, 42, {:THREE => {'FOUR' => 4}}]})
28
+ end
29
+ end # "context '#spec_helper_hupcase' do"
30
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Scimitar::Support::HashWithIndifferentCaseInsensitiveAccess do
4
+ shared_examples 'an indifferent access, case insensitive Hash' do
5
+ context 'where keys set as strings' do
6
+ it 'can be retrieved via any case' do
7
+ subject()['foo'] = 1
8
+
9
+ expect(subject()['FOO']).to eql(1)
10
+ expect(subject()[:FoO ]).to eql(1)
11
+ expect(subject()['bar']).to be_nil
12
+ end
13
+
14
+ it 'can be checked for via any case' do
15
+ subject()['foo'] = 1
16
+
17
+ expect(subject()).to have_key('FOO')
18
+ expect(subject()).to have_key(:FoO )
19
+ expect(subject()).to_not have_key('bar')
20
+ end
21
+ end # "context 'where keys set as strings' do"
22
+
23
+ context 'where keys set as symbols' do
24
+ it 'retrieves via any case' do
25
+ subject()[:foo] = 1
26
+
27
+ expect(subject()['FOO']).to eql(1)
28
+ expect(subject()[:FoO ]).to eql(1)
29
+ expect(subject()['bar']).to be_nil
30
+ end
31
+
32
+ it 'enquires via any case' do
33
+ subject()[:foo] = 1
34
+
35
+ expect(subject()).to have_key('FOO')
36
+ expect(subject()).to have_key(:FoO )
37
+ expect(subject()).to_not have_key('bar')
38
+ end
39
+ end # "context 'where keys set as symbols' do"
40
+ end # "shared_examples 'an indifferent access, case insensitive Hash' do"
41
+
42
+ context 'when created directly' do
43
+ subject do
44
+ described_class.new()
45
+ end
46
+
47
+ it_behaves_like 'an indifferent access, case insensitive Hash'
48
+ end # "context 'when created directly' do"
49
+
50
+ context 'when created through conversion' do
51
+ subject do
52
+ { 'test' => 2 }.with_indifferent_access.with_indifferent_case_insensitive_access()
53
+ end
54
+
55
+ it 'includes the original data' do
56
+ expect(subject()[:TEST]).to eql(2)
57
+ end
58
+
59
+ it_behaves_like 'an indifferent access, case insensitive Hash'
60
+ end # "context 'converting hashes' do"
61
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scimitar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RIP Global
@@ -9,36 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-24 00:00:00.000000000 Z
12
+ date: 2021-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '6.0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '6.0'
28
- - !ruby/object:Gem::Dependency
29
- name: nokogiri
30
16
  requirement: !ruby/object:Gem::Requirement
31
17
  requirements:
32
18
  - - "~>"
33
19
  - !ruby/object:Gem::Version
34
- version: '1.11'
20
+ version: '6.0'
35
21
  type: :runtime
36
22
  prerelease: false
37
23
  version_requirements: !ruby/object:Gem::Requirement
38
24
  requirements:
39
25
  - - "~>"
40
26
  - !ruby/object:Gem::Version
41
- version: '1.11'
27
+ version: '6.0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: rake
44
30
  requirement: !ruby/object:Gem::Requirement
@@ -101,14 +87,14 @@ dependencies:
101
87
  requirements:
102
88
  - - "~>"
103
89
  - !ruby/object:Gem::Version
104
- version: '4.0'
90
+ version: '5.0'
105
91
  type: :development
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
95
  - - "~>"
110
96
  - !ruby/object:Gem::Version
111
- version: '4.0'
97
+ version: '5.0'
112
98
  - !ruby/object:Gem::Dependency
113
99
  name: byebug
114
100
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +125,7 @@ dependencies:
139
125
  version: '1.1'
140
126
  description: SCIM v2 support for Users and Groups in Ruby On Rails
141
127
  email:
142
- - andrew@ripglobal.com
128
+ - dev@ripglobal.com
143
129
  executables: []
144
130
  extensions: []
145
131
  extra_rdoc_files: []
@@ -206,6 +192,7 @@ files:
206
192
  - config/routes.rb
207
193
  - lib/scimitar.rb
208
194
  - lib/scimitar/engine.rb
195
+ - lib/scimitar/support/hash_with_indifferent_case_insensitive_access.rb
209
196
  - lib/scimitar/version.rb
210
197
  - spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb
211
198
  - spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb
@@ -248,10 +235,13 @@ files:
248
235
  - spec/requests/controller_configuration_spec.rb
249
236
  - spec/requests/engine_spec.rb
250
237
  - spec/spec_helper.rb
238
+ - spec/spec_helper_spec.rb
239
+ - spec/support/hash_with_indifferent_case_insensitive_access_spec.rb
251
240
  homepage: https://ripglobal.com/
252
241
  licenses:
253
242
  - MIT
254
- metadata: {}
243
+ metadata:
244
+ source_code_uri: https://github.com/RIPGlobal/scimitar
255
245
  post_install_message:
256
246
  rdoc_options: []
257
247
  require_paths:
@@ -260,14 +250,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
250
  requirements:
261
251
  - - ">="
262
252
  - !ruby/object:Gem::Version
263
- version: 2.7.2
253
+ version: 2.7.0
264
254
  required_rubygems_version: !ruby/object:Gem::Requirement
265
255
  requirements:
266
256
  - - ">="
267
257
  - !ruby/object:Gem::Version
268
258
  version: '0'
269
259
  requirements: []
270
- rubygems_version: 3.1.4
260
+ rubygems_version: 3.1.6
271
261
  signing_key:
272
262
  specification_version: 4
273
263
  summary: SCIM v2 for Rails
@@ -290,6 +280,8 @@ test_files:
290
280
  - spec/requests/engine_spec.rb
291
281
  - spec/requests/active_record_backed_resources_controller_spec.rb
292
282
  - spec/requests/application_controller_spec.rb
283
+ - spec/spec_helper_spec.rb
284
+ - spec/support/hash_with_indifferent_case_insensitive_access_spec.rb
293
285
  - spec/controllers/scimitar/schemas_controller_spec.rb
294
286
  - spec/controllers/scimitar/resource_types_controller_spec.rb
295
287
  - spec/controllers/scimitar/resources_controller_spec.rb