scimitar 1.0.3 → 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.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RIP Global
@@ -9,7 +9,7 @@ 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
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '4.0'
90
+ version: '5.0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '4.0'
97
+ version: '5.0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: byebug
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +192,7 @@ files:
192
192
  - config/routes.rb
193
193
  - lib/scimitar.rb
194
194
  - lib/scimitar/engine.rb
195
+ - lib/scimitar/support/hash_with_indifferent_case_insensitive_access.rb
195
196
  - lib/scimitar/version.rb
196
197
  - spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb
197
198
  - spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb
@@ -234,6 +235,8 @@ files:
234
235
  - spec/requests/controller_configuration_spec.rb
235
236
  - spec/requests/engine_spec.rb
236
237
  - spec/spec_helper.rb
238
+ - spec/spec_helper_spec.rb
239
+ - spec/support/hash_with_indifferent_case_insensitive_access_spec.rb
237
240
  homepage: https://ripglobal.com/
238
241
  licenses:
239
242
  - MIT
@@ -254,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
257
  - !ruby/object:Gem::Version
255
258
  version: '0'
256
259
  requirements: []
257
- rubygems_version: 3.1.4
260
+ rubygems_version: 3.1.6
258
261
  signing_key:
259
262
  specification_version: 4
260
263
  summary: SCIM v2 for Rails
@@ -277,6 +280,8 @@ test_files:
277
280
  - spec/requests/engine_spec.rb
278
281
  - spec/requests/active_record_backed_resources_controller_spec.rb
279
282
  - spec/requests/application_controller_spec.rb
283
+ - spec/spec_helper_spec.rb
284
+ - spec/support/hash_with_indifferent_case_insensitive_access_spec.rb
280
285
  - spec/controllers/scimitar/schemas_controller_spec.rb
281
286
  - spec/controllers/scimitar/resource_types_controller_spec.rb
282
287
  - spec/controllers/scimitar/resources_controller_spec.rb