libis-services 1.0.5 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,7 @@ describe 'Scope search service' do
18
18
  it 'by repcode' do
19
19
  data = {
20
20
  'dc:title' => 'Archief Sint-Vincentius a Paulogenootschap, Conferentie Onze-Lieve-Vrouw van de Rozenkrans Antwerpen',
21
- 'dc:identifier' => ['BE/942855/580 (ref.code)'],
21
+ 'dc:identifier' => ['BE/942855/580'],
22
22
  'dc:source' => ['BE/942855']
23
23
  }
24
24
  result = subject.query 'BE-942855-580', type: 'REPCODE'
@@ -29,7 +29,7 @@ describe 'Scope search service' do
29
29
  it 'by id' do
30
30
  data = {
31
31
  'dc:title' => 'Archief Constant Guillaume Van Crombrugghe',
32
- 'dc:identifier' => ['BE/942855/1569 (ref.code)'],
32
+ 'dc:identifier' => ['BE/942855/1569'],
33
33
  'dc:source' => ['BE/942855/1569']
34
34
  }
35
35
  result = subject.query '332785', type: 'ID'
data/spec/spec_helper.rb CHANGED
@@ -17,6 +17,7 @@ RSpec::Matchers.define :deep_include do
17
17
  match {|actual| deep_include?(actual, expected)}
18
18
 
19
19
  def deep_include?(actual, expected, path = [])
20
+
20
21
  return true if actual == expected
21
22
 
22
23
  @failing_actual = actual
@@ -25,45 +26,71 @@ RSpec::Matchers.define :deep_include do
25
26
 
26
27
  case expected
27
28
  when Array
28
- return false unless actual.is_a? Array
29
+ unless actual.is_a? Array
30
+ @failure ||= :not_an_array
31
+ return false
32
+ end
29
33
  expected.each_with_index do |expected_item, index|
30
34
  match_found = actual.any? do |actual_item|
31
35
  deep_include? actual_item, expected_item, path + [index]
32
36
  end
33
37
  unless match_found
34
- @failing_array = actual
35
- @failing_array_path = path + [index]
36
- @failing_expected_array_item = expected_item
38
+ @failure ||= :item_not_found
39
+ @failing_array_item = expected_item
37
40
  return false
38
41
  end
39
42
  end
40
43
  when Hash
41
- return false unless actual.is_a? Hash
44
+ unless actual.is_a? Hash
45
+ @failure ||= :not_a_hash
46
+ return false
47
+ end
42
48
  expected.all? do |key, expected_value|
43
- return false unless actual.has_key? key
44
- deep_include? actual[key], expected_value, path + [key]
49
+ unless actual.has_key? key
50
+ @failure ||= :key_not_found
51
+ @failing_key = key
52
+ return false
53
+ end
54
+ v = deep_include? actual[key], expected_value, path + [key]
55
+ v
45
56
  end
46
57
  else
58
+ @failure ||= :no_match
47
59
  false
48
60
  end
61
+
49
62
  end
50
63
 
51
64
  failure_message do |_actual|
52
- if @failing_array_path
53
- path = @failing_array_path.map {|p| "[#{p.inspect}]"}.join
54
- path = "root" if path.blank?
55
- message = "Actual array did not include value at #{path}: \n" +
56
- " expected #{@failing_expected_array_item.inspect}\n" +
57
- " but matching value not found in array: #{@failing_array}\n"
65
+ path = @failing_path.map {|p| "[#{p.inspect}]"}.join
66
+ path = "root" if path.blank?
67
+ case @failure
68
+ when :no_match
69
+ "Actual value did not match expected value at #{path}: \n" +
70
+ " expected #{@failing_expected.inspect}\n" +
71
+ " got #{@failing_actual.inspect}\n"
72
+ when :not_an_array
73
+ "Actual object is not an Array at #{path}: \n" +
74
+ " expected: #{@failing_expected.inspect}\n" +
75
+ " got: #{@failing_actual}"
76
+ when :not_a_hash
77
+ "Actual object is not a Hash at #{path}: \n" +
78
+ " expected: #{@failing_expected.inspect}\n" +
79
+ " got: #{@failing_actual}"
80
+ when :item_not_found
81
+ "Actual array did not include value at #{path}: \n" +
82
+ " expected #{@failing_array_item.inspect}\n" +
83
+ " but matching value not found in array: #{@failing_actual.inspect}\n"
84
+ when :key_not_found
85
+ "Actual hash did not include expected key at #{path}: \n" +
86
+ " key #{@failing_key}\n" +
87
+ " expected #{@failing_expected.inspect}\n" +
88
+ " got #{@failing_actual.inspect}\n"
58
89
  else
59
- path = @failing_path.map {|p| "[#{p.inspect}]"}.join
60
- path = "root" if path.blank?
61
- message = "Actual hash did not include expected value at #{path}: \n" +
62
- " expected #{@failing_expected.inspect}\n" +
63
- " got #{@failing_actual.inspect}\n"
90
+ "Mismatch at #{path}: \n" +
91
+ " expected #{@failing_expected.inspect}\n" +
92
+ " got #{@failing_actual.inspect}\n"
64
93
  end
65
-
66
- message
67
94
  end
68
95
  end
69
96
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-08 00:00:00.000000000 Z
11
+ date: 2021-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rexml
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: libis-tools
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +114,14 @@ dependencies:
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '1.7'
117
+ version: '2.0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '1.7'
124
+ version: '2.0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: savon
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +156,14 @@ dependencies:
142
156
  requirements:
143
157
  - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '0.4'
159
+ version: '1.0'
146
160
  type: :runtime
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
164
  - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0.4'
166
+ version: '1.0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: ruby-oci8
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -267,6 +281,7 @@ files:
267
281
  - lib/libis/services/rosetta/oai_set.rb
268
282
  - lib/libis/services/rosetta/pds_handler.rb
269
283
  - lib/libis/services/rosetta/producer.rb
284
+ - lib/libis/services/rosetta/producer_agent.rb
270
285
  - lib/libis/services/rosetta/producer_handler.rb
271
286
  - lib/libis/services/rosetta/service.rb
272
287
  - lib/libis/services/rosetta/sip.rb
@@ -317,8 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
332
  - !ruby/object:Gem::Version
318
333
  version: '0'
319
334
  requirements: []
320
- rubyforge_project:
321
- rubygems_version: 2.5.1
335
+ rubygems_version: 3.2.15
322
336
  signing_key:
323
337
  specification_version: 4
324
338
  summary: LIBIS Services toolbox.