libis-services 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@ describe 'Rosetta SIP Service' do
20
20
  { module: 'PER', stage: 'Finished', status: 'FINISHED' }
21
21
  }
22
22
 
23
- let(:expected_ies) { [{pid: 'IE433994'}] }
23
+ let(:expected_ies) { [{pid: 'IE403595'}] }
24
24
 
25
25
  it 'should get SIP info' do
26
26
 
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.each_with_index { |value, i| check_container(value, result[i]) }
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
- expect(result[key]).not_to be_nil
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.11
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: 2016-12-19 00:00:00.000000000 Z
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