libis-services 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/libis/services/oai.rb +1 -1
- data/lib/libis/services/oracle_client.rb +22 -1
- data/lib/libis/services/rosetta/client.rb +11 -1
- data/lib/libis/services/rosetta/deposit_handler.rb +1 -1
- data/lib/libis/services/rosetta/oai_pmh.rb +1 -1
- data/lib/libis/services/rosetta/producer_handler.rb +2 -1
- data/lib/libis/services/rosetta_db/client.rb +28 -0
- data/lib/libis/services/scope/search.rb +10 -2
- data/lib/libis/services/soap_client.rb +2 -0
- data/lib/libis/services/version.rb +1 -1
- data/libis-services.gemspec +1 -0
- data/spec/alma_service_spec.rb +28 -28
- data/spec/ie_data.rb +3 -56
- data/spec/primo_limo_spec.rb +7 -3
- data/spec/primo_search_spec.rb +2 -0
- data/spec/rosetta_auth_spec.rb +165 -0
- data/spec/rosetta_collection_spec.rb +2 -2
- data/spec/rosetta_deposit_spec.rb +20 -20
- data/spec/rosetta_ie_spec.rb +4 -2
- data/spec/rosetta_oai_spec.rb +6 -4
- data/spec/rosetta_producer_spec.rb +104 -102
- data/spec/rosetta_sip_spec.rb +1 -1
- data/spec/spec_helper.rb +67 -3
- metadata +19 -2
data/spec/rosetta_sip_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -8,21 +8,85 @@ require 'bundler/setup'
|
|
8
8
|
Bundler.setup
|
9
9
|
|
10
10
|
require 'rspec'
|
11
|
+
require 'rspec/matchers'
|
11
12
|
require 'libis-services'
|
12
13
|
|
14
|
+
# adapted from https://gist.github.com/mltsy/21fd5e15ae12a004c8b13d6ec4534458
|
15
|
+
RSpec::Matchers.define :deep_include do
|
16
|
+
|
17
|
+
match {|actual| deep_include?(actual, expected)}
|
18
|
+
|
19
|
+
def deep_include?(actual, expected, path = [])
|
20
|
+
return true if actual == expected
|
21
|
+
|
22
|
+
@failing_actual = actual
|
23
|
+
@failing_expected = expected
|
24
|
+
@failing_path = path
|
25
|
+
|
26
|
+
case expected
|
27
|
+
when Array
|
28
|
+
return false unless actual.is_a? Array
|
29
|
+
expected.each_with_index do |expected_item, index|
|
30
|
+
match_found = actual.any? do |actual_item|
|
31
|
+
deep_include? actual_item, expected_item, path + [index]
|
32
|
+
end
|
33
|
+
unless match_found
|
34
|
+
@failing_array = actual
|
35
|
+
@failing_array_path = path + [index]
|
36
|
+
@failing_expected_array_item = expected_item
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
when Hash
|
41
|
+
return false unless actual.is_a? Hash
|
42
|
+
expected.all? do |key, expected_value|
|
43
|
+
return false unless actual.has_key? key
|
44
|
+
deep_include? actual[key], expected_value, path + [key]
|
45
|
+
end
|
46
|
+
else
|
47
|
+
false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
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"
|
58
|
+
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"
|
64
|
+
end
|
65
|
+
|
66
|
+
message
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
13
70
|
def check_container(expected, result)
|
71
|
+
# puts "Checking expected: #{expected} vs result: #{result}"
|
14
72
|
case expected
|
15
73
|
when Array
|
74
|
+
# puts "Checking if result is an array"
|
16
75
|
expect(result).to be_a Array
|
17
|
-
expected.
|
76
|
+
expected.each do |value|
|
77
|
+
# puts "Checking if expected value: #{value} included in result"
|
78
|
+
expect(result).to include(value)
|
79
|
+
end
|
18
80
|
when Hash
|
81
|
+
# puts "Checking if result is a hash"
|
19
82
|
expect(result).to be_a Hash
|
20
83
|
expected.each_key do |key|
|
21
|
-
|
84
|
+
# puts "Checking if expected key: #{key} included in result"
|
85
|
+
expect(result).to include(key)
|
22
86
|
check_container(expected[key], result[key])
|
23
87
|
end
|
24
88
|
else
|
89
|
+
# puts "Checking if expected equals result"
|
25
90
|
expect(result).to eq expected
|
26
91
|
end
|
27
92
|
end
|
28
|
-
|
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: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1.6'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: httpclient
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - "~>"
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '2.8'
|
230
|
+
type: :runtime
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '2.8'
|
223
237
|
description: Set of classes that simplify connection to different LIBIS services.
|
224
238
|
email:
|
225
239
|
- kris.dekeyser@libis.be
|
@@ -273,6 +287,7 @@ files:
|
|
273
287
|
- lib/libis/services/rosetta/sip_handler.rb
|
274
288
|
- lib/libis/services/rosetta/user.rb
|
275
289
|
- lib/libis/services/rosetta/user_manager.rb
|
290
|
+
- lib/libis/services/rosetta_db/client.rb
|
276
291
|
- lib/libis/services/scope/search.rb
|
277
292
|
- lib/libis/services/search_factory.rb
|
278
293
|
- lib/libis/services/service_error.rb
|
@@ -287,6 +302,7 @@ files:
|
|
287
302
|
- spec/ie_data.rb
|
288
303
|
- spec/primo_limo_spec.rb
|
289
304
|
- spec/primo_search_spec.rb
|
305
|
+
- spec/rosetta_auth_spec.rb
|
290
306
|
- spec/rosetta_collection_spec.rb
|
291
307
|
- spec/rosetta_deposit_spec.rb
|
292
308
|
- spec/rosetta_ie_spec.rb
|
@@ -324,6 +340,7 @@ test_files:
|
|
324
340
|
- spec/ie_data.rb
|
325
341
|
- spec/primo_limo_spec.rb
|
326
342
|
- spec/primo_search_spec.rb
|
343
|
+
- spec/rosetta_auth_spec.rb
|
327
344
|
- spec/rosetta_collection_spec.rb
|
328
345
|
- spec/rosetta_deposit_spec.rb
|
329
346
|
- spec/rosetta_ie_spec.rb
|