hoodoo 2.12.0 → 2.12.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hoodoo/client/endpoint/endpoints/http.rb +15 -0
- data/lib/hoodoo/presenters/base.rb +15 -3
- data/lib/hoodoo/presenters/base_dsl.rb +8 -0
- data/lib/hoodoo/presenters/common_resource_fields.rb +1 -0
- data/lib/hoodoo/presenters/types/hash.rb +6 -3
- data/lib/hoodoo/services/middleware/middleware.rb +4 -2
- data/lib/hoodoo/version.rb +2 -2
- data/spec/client/client_spec.rb +26 -11
- data/spec/presenters/base_spec.rb +8 -3
- data/spec/presenters/common_resource_fields_spec.rb +3 -1
- data/spec/presenters/types/hash_spec.rb +88 -0
- data/spec/services/services/response_spec.rb +9 -9
- data/spec/utilities/utilities_spec.rb +3 -3
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8db3ad23e93ddb58cfa9c5d41342cbab01f00ce55e57b37cd93748732da340
|
4
|
+
data.tar.gz: bead6ded0b48b1b7ed361b9ec07ae59cdb0a797342ad8f96bac3b000bfc2cbf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ecf3d0a5c33119941526e9b04684f72ed12c96d351755fcaa773e8b4b14918bc5a55a57cd4411d592448f54b25d09546f249ba37b7fca50c26e2d341a2f02cd
|
7
|
+
data.tar.gz: 523010953e4d7d3a07036224158163bc43743a45afe1ce5c106102ff50e1ae251090d4c04b2b8f3faa741d14032e68479e484273aaf7021d6c428a67a707c666
|
@@ -56,7 +56,22 @@ module Hoodoo
|
|
56
56
|
|
57
57
|
# See Hoodoo::Client::Endpoint#show.
|
58
58
|
#
|
59
|
+
# In RESTful HTTP, `GET /resources/#{ident = nil}` gets evaluated
|
60
|
+
# as `GET /resources/`, which is of course interpreted as a #list
|
61
|
+
# request. Since this is undesirable behaviour, the +ident+ must be
|
62
|
+
# populated, and this will return `404 Not Found` if it is not.
|
63
|
+
#
|
59
64
|
def show( ident, query_hash = nil )
|
65
|
+
if ident.nil?
|
66
|
+
data = response_class_for( :show ).new
|
67
|
+
data.platform_errors.add_error(
|
68
|
+
'platform.not_found',
|
69
|
+
'reference' => {entity_name: 'nil identifier given on :show action'}
|
70
|
+
)
|
71
|
+
|
72
|
+
return data
|
73
|
+
end
|
74
|
+
|
60
75
|
d = @description.dup
|
61
76
|
d.action = :show
|
62
77
|
d.ident = ident
|
@@ -90,12 +90,16 @@ module Hoodoo
|
|
90
90
|
# were used to create the Session under which the
|
91
91
|
# resource instance was created. Absent if omitted.
|
92
92
|
#
|
93
|
+
# +updated_at+:: Optional Date/Time of instance update. This is a Ruby
|
94
|
+
# DateTime instance or similar, _NOT_ a string!
|
95
|
+
#
|
93
96
|
def self.render( data,
|
94
97
|
uuid = nil,
|
95
98
|
created_at = nil,
|
96
99
|
language = 'en-nz',
|
97
|
-
created_by = nil
|
98
|
-
|
100
|
+
created_by = nil,
|
101
|
+
updated_at = nil
|
102
|
+
)
|
99
103
|
target = {}
|
100
104
|
data = data || {}
|
101
105
|
|
@@ -126,6 +130,7 @@ module Hoodoo
|
|
126
130
|
'created_at' => Hoodoo::Utilities.standard_datetime( created_at.to_datetime )
|
127
131
|
} )
|
128
132
|
|
133
|
+
target[ 'updated_at' ] = Hoodoo::Utilities.standard_datetime( updated_at.to_datetime ) unless updated_at.nil?
|
129
134
|
target[ 'created_by' ] = created_by unless created_by.nil?
|
130
135
|
target[ 'language' ] = language if self.is_internationalised?()
|
131
136
|
|
@@ -167,6 +172,9 @@ module Hoodoo
|
|
167
172
|
# +created_at+:: Same as the +created_at+ parameter to ::render, except
|
168
173
|
# mandatory.
|
169
174
|
#
|
175
|
+
# +updated_at+:: Optional value expressing the time the resource was last
|
176
|
+
# updated.
|
177
|
+
#
|
170
178
|
# +created_by+:: Optional fingerprint of the Caller whose credentials
|
171
179
|
# were used to create the Session under which the
|
172
180
|
# resource instance was created.
|
@@ -194,13 +202,14 @@ module Hoodoo
|
|
194
202
|
def self.render_in( context, data, options = {} )
|
195
203
|
uuid = options[ :uuid ]
|
196
204
|
created_at = options[ :created_at ]
|
205
|
+
updated_at = options[ :updated_at ]
|
197
206
|
created_by = options[ :created_by ]
|
198
207
|
language = options[ :language ] || context.request.locale
|
199
208
|
secured_with = options[ :secured_with ]
|
200
209
|
embeds = options[ :embeds ]
|
201
210
|
references = options[ :references ]
|
202
211
|
|
203
|
-
target = self.render( data, uuid, created_at, language, created_by )
|
212
|
+
target = self.render( data, uuid, created_at, language, created_by, updated_at )
|
204
213
|
|
205
214
|
if defined?( ::ActiveRecord ) && secured_with.is_a?( ::ActiveRecord::Base )
|
206
215
|
result_hash = {}
|
@@ -251,6 +260,9 @@ module Hoodoo
|
|
251
260
|
created_by = data[ :created_by ]
|
252
261
|
common_fields[ 'created_by' ] = created_by unless created_by.nil?
|
253
262
|
|
263
|
+
updated_at = data[ :updated_at ]
|
264
|
+
common_fields[ 'updated_at' ] = updated_at unless updated_at.nil?
|
265
|
+
|
254
266
|
if self.is_internationalised?
|
255
267
|
common_fields[ 'internationalised' ] = data[ 'internationalised' ]
|
256
268
|
Hoodoo::Presenters::CommonResourceFields.get_schema.properties[ 'language' ].required = true
|
@@ -747,6 +747,10 @@ module Hoodoo
|
|
747
747
|
# Hoodoo::Presenters::Text
|
748
748
|
# [:uuid]
|
749
749
|
# Hoodoo::Presenters::UUID
|
750
|
+
# [:hash]
|
751
|
+
# Hoodoo::Presenters::Hash
|
752
|
+
# [:object]
|
753
|
+
# Hoodoo::Presenters::Object
|
750
754
|
#
|
751
755
|
def type_option_to_class( type )
|
752
756
|
case type
|
@@ -776,6 +780,10 @@ module Hoodoo
|
|
776
780
|
Hoodoo::Presenters::Text
|
777
781
|
when :uuid
|
778
782
|
Hoodoo::Presenters::UUID
|
783
|
+
when :object
|
784
|
+
Hoodoo::Presenters::Object
|
785
|
+
when :hash
|
786
|
+
Hoodoo::Presenters::Hash
|
779
787
|
else
|
780
788
|
raise "Unsupported 'type' option value of '#{ type }' in Hoodoo::Presenters::BaseDSL"
|
781
789
|
end
|
@@ -58,9 +58,12 @@ module Hoodoo
|
|
58
58
|
end
|
59
59
|
|
60
60
|
@specific = true
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
|
62
|
+
# If an explicit type is given, use that. Otherwise, default to Field
|
63
|
+
# if no block is given, or Object is a block is given.
|
64
|
+
#
|
65
|
+
value_klass = !(options[:type].nil? || options[:type] == '') ? type_option_to_class( options.delete( :type ) ) :
|
66
|
+
(block_given? ? Hoodoo::Presenters::Object : Hoodoo::Presenters::Field)
|
64
67
|
|
65
68
|
# If we're defining specific keys and some of those keys have fields
|
66
69
|
# with defaults, we need to merge those up to provide a whole-Hash
|
@@ -132,12 +132,14 @@ module Hoodoo; module Services
|
|
132
132
|
MAXIMUM_PAYLOAD_SIZE = 1048576 # 1MB Should Be Enough For Anyone
|
133
133
|
|
134
134
|
# Maximum *logged* payload (inbound data) size.
|
135
|
+
# Keep consistent with max payload size so data is not lost from the logs.
|
135
136
|
#
|
136
|
-
MAXIMUM_LOGGED_PAYLOAD_SIZE =
|
137
|
+
MAXIMUM_LOGGED_PAYLOAD_SIZE = MAXIMUM_PAYLOAD_SIZE
|
137
138
|
|
138
139
|
# Maximum *logged* response (outbound data) size.
|
140
|
+
# Keep consistent with max payload size so data is not lost from the logs.
|
139
141
|
#
|
140
|
-
MAXIMUM_LOGGED_RESPONSE_SIZE =
|
142
|
+
MAXIMUM_LOGGED_RESPONSE_SIZE = MAXIMUM_PAYLOAD_SIZE
|
141
143
|
|
142
144
|
# The default test session; a Hoodoo::Services::Session instance with the
|
143
145
|
# following characteristics:
|
data/lib/hoodoo/version.rb
CHANGED
@@ -12,11 +12,11 @@ module Hoodoo
|
|
12
12
|
# The Hoodoo gem version. If this changes, be sure to re-run
|
13
13
|
# <tt>bundle install</tt> or <tt>bundle update</tt>.
|
14
14
|
#
|
15
|
-
VERSION = '2.12.
|
15
|
+
VERSION = '2.12.6'
|
16
16
|
|
17
17
|
# The Hoodoo gem date. If this changes, be sure to re-run
|
18
18
|
# <tt>bundle install</tt> or <tt>bundle update</tt>.
|
19
19
|
#
|
20
|
-
DATE = '
|
20
|
+
DATE = '2020-11-10'
|
21
21
|
|
22
22
|
end
|
data/spec/client/client_spec.rb
CHANGED
@@ -388,6 +388,14 @@ describe Hoodoo::Client do
|
|
388
388
|
expect( result.platform_errors.has_errors? ).to eq( false )
|
389
389
|
expect( result[ 'kind' ] ).to eq( 'Errors' )
|
390
390
|
end
|
391
|
+
|
392
|
+
it 'returns a 404 for show(nil)', :wont_create_net_http do
|
393
|
+
result = @endpoint.show( nil )
|
394
|
+
|
395
|
+
expect( result.platform_errors.has_errors? ).to eq( true )
|
396
|
+
expect( result.platform_errors.errors[ 0 ][ 'code' ] ).to eq( 'platform.not_found' )
|
397
|
+
expect( result.platform_errors.errors[ 0 ][ 'reference' ] ).to eq( 'nil identifier given on :show action' )
|
398
|
+
end
|
391
399
|
end
|
392
400
|
|
393
401
|
before :each do
|
@@ -451,6 +459,11 @@ describe Hoodoo::Client do
|
|
451
459
|
end
|
452
460
|
|
453
461
|
context 'and with an HTTP proxy via custom discoverer' do
|
462
|
+
around :each do | example |
|
463
|
+
@example_wont_create_net_http = example.metadata[ :wont_create_net_http ]
|
464
|
+
example.run
|
465
|
+
end
|
466
|
+
|
454
467
|
before :each do
|
455
468
|
base_uri = "http://localhost:#{ @port }"
|
456
469
|
proxy_uri = 'http://foo:bar@proxyhost:1234'
|
@@ -459,17 +472,19 @@ describe Hoodoo::Client do
|
|
459
472
|
proxy_uri: proxy_uri
|
460
473
|
)
|
461
474
|
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
expect(
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
475
|
+
if @example_wont_create_net_http
|
476
|
+
expect( Net::HTTP ).not_to receive( :new )
|
477
|
+
else
|
478
|
+
expect( Net::HTTP ).to receive( :new ).at_least( :once ).and_wrap_original do | original_new, host, port, proxy_host, proxy_port, proxy_user, proxy_pass |
|
479
|
+
expect( host ).to eq( 'localhost' )
|
480
|
+
expect( port ).to eq( @port )
|
481
|
+
expect( proxy_host ).to eq( 'proxyhost' )
|
482
|
+
expect( proxy_port ).to eq( 1234 )
|
483
|
+
expect( proxy_user ).to eq( 'foo' )
|
484
|
+
expect( proxy_pass ).to eq( 'bar' )
|
485
|
+
|
486
|
+
original_new.call( host, port )
|
487
|
+
end
|
473
488
|
end
|
474
489
|
|
475
490
|
set_vars_for(
|
@@ -362,7 +362,8 @@ describe '#schema' do
|
|
362
362
|
Hoodoo::UUID.generate,
|
363
363
|
Time.now,
|
364
364
|
'en-gb',
|
365
|
-
Hoodoo::UUID.generate
|
365
|
+
Hoodoo::UUID.generate,
|
366
|
+
Time.now
|
366
367
|
)
|
367
368
|
|
368
369
|
expect(Hoodoo::Data::Resources::World.validate(rendered, true).errors).to eq([])
|
@@ -707,6 +708,7 @@ describe '#schema' do
|
|
707
708
|
'id' => @uuid,
|
708
709
|
'kind' => 'World',
|
709
710
|
'created_at' => Hoodoo::Utilities.standard_datetime( @time ),
|
711
|
+
'updated_at' => Hoodoo::Utilities.standard_datetime( @time ),
|
710
712
|
'language' => 'en-gb',
|
711
713
|
'errors_id' => @input['errors_id'],
|
712
714
|
'test_tags' => 'foo,bar,baz',
|
@@ -729,7 +731,9 @@ describe '#schema' do
|
|
729
731
|
@input,
|
730
732
|
@uuid,
|
731
733
|
@time,
|
732
|
-
'en-gb'
|
734
|
+
'en-gb',
|
735
|
+
nil,
|
736
|
+
@time
|
733
737
|
)
|
734
738
|
).to( eq( @output ) )
|
735
739
|
end
|
@@ -744,7 +748,8 @@ describe '#schema' do
|
|
744
748
|
@uuid,
|
745
749
|
@time,
|
746
750
|
'en-gb',
|
747
|
-
fingerprint
|
751
|
+
fingerprint,
|
752
|
+
@time
|
748
753
|
)
|
749
754
|
).to( eq( @output ) )
|
750
755
|
end
|
@@ -6,13 +6,15 @@ describe Hoodoo::Presenters::CommonResourceFields do
|
|
6
6
|
|
7
7
|
expect(schema.is_internationalised?()).to eq(false)
|
8
8
|
|
9
|
-
expect(schema.properties.count).to eq(
|
9
|
+
expect(schema.properties.count).to eq(8)
|
10
10
|
|
11
11
|
expect(schema.properties['id']).to be_a(Hoodoo::Presenters::UUID)
|
12
12
|
expect(schema.properties['id'].required).to eq(true)
|
13
13
|
expect(schema.properties['id'].resource).to be_nil
|
14
14
|
expect(schema.properties['created_at']).to be_a(Hoodoo::Presenters::DateTime)
|
15
15
|
expect(schema.properties['created_at'].required).to eq(true)
|
16
|
+
expect(schema.properties['updated_at']).to be_a(Hoodoo::Presenters::DateTime)
|
17
|
+
expect(schema.properties['updated_at'].required).to eq(false)
|
16
18
|
expect(schema.properties['kind']).to be_a(Hoodoo::Presenters::Text)
|
17
19
|
expect(schema.properties['kind'].required).to eq(true)
|
18
20
|
expect(schema.properties['language']).to be_a(Hoodoo::Presenters::Text)
|
@@ -663,6 +663,94 @@ describe Hoodoo::Presenters::Hash do
|
|
663
663
|
|
664
664
|
############################################################################
|
665
665
|
|
666
|
+
class TestHashKeyWithHashType < Hoodoo::Presenters::Base
|
667
|
+
schema do
|
668
|
+
hash :key_with_hash_type do
|
669
|
+
key :specific_hash, :type => :hash do
|
670
|
+
key :optional_field, required: false
|
671
|
+
key :required_field, required: true
|
672
|
+
end
|
673
|
+
key :generic_hash, :type => :hash do
|
674
|
+
keys :length => 6
|
675
|
+
end
|
676
|
+
end
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
|
681
|
+
############################################################################
|
682
|
+
|
683
|
+
context 'specific key with a hash as the type' do
|
684
|
+
context '#render' do
|
685
|
+
it 'renders required fields correctly' do
|
686
|
+
input_data = { 'key_with_hash_type' => {
|
687
|
+
'specific_hash' => {'required_field' => 'foo'}
|
688
|
+
} }
|
689
|
+
expected_data = { 'key_with_hash_type' => {
|
690
|
+
'specific_hash' => {'required_field' => 'foo'}
|
691
|
+
} }
|
692
|
+
|
693
|
+
expect( TestHashKeyWithHashType.render( input_data ) ).to eq( expected_data )
|
694
|
+
end
|
695
|
+
|
696
|
+
it 'renders optional fields correctly' do
|
697
|
+
input_data = { 'key_with_hash_type' => {
|
698
|
+
'specific_hash' => {'required_field' => 'foo', 'optional_field' => 'bar'},
|
699
|
+
'generic_hash' => {'foo' => 'bar', 'somekey' => 'somevalue'}
|
700
|
+
} }
|
701
|
+
expected_data = { 'key_with_hash_type' => {
|
702
|
+
'specific_hash' => {'required_field' => 'foo', 'optional_field' => 'bar'},
|
703
|
+
'generic_hash' => {'foo' => 'bar', 'somekey' => 'somevalue'}
|
704
|
+
} }
|
705
|
+
|
706
|
+
expect( TestHashKeyWithHashType.render( input_data ) ).to eq( expected_data )
|
707
|
+
end
|
708
|
+
end
|
709
|
+
|
710
|
+
context '#validate' do
|
711
|
+
it 'succeeds if the key is optional and absent' do
|
712
|
+
expect( TestHashKeyWithHashType.validate( {} ).errors.size ).to( eql( 0 ) )
|
713
|
+
end
|
714
|
+
|
715
|
+
it 'succeeds if the key is present and its specific required keys are present' do
|
716
|
+
input_data = { 'key_with_hash_type' => {
|
717
|
+
'specific_hash' => {'required_field' => 'foo'}
|
718
|
+
} }
|
719
|
+
expect( TestHashKeyWithHashType.validate( input_data ).errors.size ).to( eql( 0 ) )
|
720
|
+
end
|
721
|
+
|
722
|
+
it 'succeeds if the key is present and its specific required and optional keys are present' do
|
723
|
+
input_data = { 'key_with_hash_type' => {
|
724
|
+
'specific_hash' => {'required_field' => 'foo', 'optional_field' => 'bar'}
|
725
|
+
} }
|
726
|
+
expect( TestHashKeyWithHashType.validate( input_data ).errors.size ).to( eql( 0 ) )
|
727
|
+
end
|
728
|
+
|
729
|
+
it 'fails if the key is present and its specific required keys are missing' do
|
730
|
+
input_data = { 'key_with_hash_type' => {
|
731
|
+
'specific_hash' => {'optional_field' => 'bar'}
|
732
|
+
} }
|
733
|
+
expect( TestHashKeyWithHashType.validate( input_data ).errors.size ).to( eql( 1 ) )
|
734
|
+
end
|
735
|
+
|
736
|
+
it 'succeeds if the key is present and its generic keys are valid' do
|
737
|
+
input_data = { 'key_with_hash_type' => {
|
738
|
+
'generic_hash' => {'foo' => 'bar'}
|
739
|
+
} }
|
740
|
+
expect( TestHashKeyWithHashType.validate( input_data ).errors.size ).to( eql( 0 ) )
|
741
|
+
end
|
742
|
+
|
743
|
+
it 'fails if the key is present and its generic keys are invalid' do
|
744
|
+
input_data = { 'key_with_hash_type' => {
|
745
|
+
'generic_hash' => {'keynametoolong' => 'bar'}
|
746
|
+
} }
|
747
|
+
expect( TestHashKeyWithHashType.validate( input_data ).errors.size ).to( eql( 1 ) )
|
748
|
+
end
|
749
|
+
end
|
750
|
+
end
|
751
|
+
|
752
|
+
############################################################################
|
753
|
+
|
666
754
|
class TestHashGenericKeyPresenterNoValues < Hoodoo::Presenters::Base
|
667
755
|
schema do
|
668
756
|
hash :generic do
|
@@ -160,7 +160,7 @@ describe Hoodoo::Services::Response do
|
|
160
160
|
expected = JSON.generate({})
|
161
161
|
expect(status).to eq(200)
|
162
162
|
expect(headers).to eq({'Content-Length' => expected.length.to_s})
|
163
|
-
expect(body
|
163
|
+
expect(body).to eq([expected])
|
164
164
|
end
|
165
165
|
|
166
166
|
it 'should return header data correctly' do
|
@@ -172,7 +172,7 @@ describe Hoodoo::Services::Response do
|
|
172
172
|
expected = JSON.generate({})
|
173
173
|
expect(status).to eq(200)
|
174
174
|
expect(headers).to eq({'X-Foo' => 'baz', 'X-Bar' => 'boo', 'Content-Length' => expected.length.to_s})
|
175
|
-
expect(body
|
175
|
+
expect(body).to eq([expected])
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'should return error condition Rack data correctly' do
|
@@ -187,7 +187,7 @@ describe Hoodoo::Services::Response do
|
|
187
187
|
expected = JSON.generate(errors_hash)
|
188
188
|
expect(status).to eq(422) # From the first error we stored, not the second
|
189
189
|
expect(headers).to eq({'Content-Length' => expected.length.to_s})
|
190
|
-
expect(body
|
190
|
+
expect(body).to eq([expected])
|
191
191
|
end
|
192
192
|
|
193
193
|
it 'should return non-error condition Rack data correctly with a Hash body' do
|
@@ -199,7 +199,7 @@ describe Hoodoo::Services::Response do
|
|
199
199
|
expected = JSON.generate(response_hash)
|
200
200
|
expect(status).to eq(200) # From the first error we stored, not the second
|
201
201
|
expect(headers).to eq({'Content-Length' => expected.length.to_s})
|
202
|
-
expect(body
|
202
|
+
expect(body).to eq([expected])
|
203
203
|
end
|
204
204
|
|
205
205
|
it 'returns non-error condition Rack data correctly with an Array body' do
|
@@ -211,7 +211,7 @@ describe Hoodoo::Services::Response do
|
|
211
211
|
expected = JSON.generate({'_data' => response_array})
|
212
212
|
expect(status).to eq(200) # From the first error we stored, not the second
|
213
213
|
expect(headers).to eq({'Content-Length' => expected.length.to_s})
|
214
|
-
expect(body
|
214
|
+
expect(body).to eq([expected])
|
215
215
|
end
|
216
216
|
|
217
217
|
it 'returns non-error condition Rack data correctly with a dataset size' do
|
@@ -223,7 +223,7 @@ describe Hoodoo::Services::Response do
|
|
223
223
|
expected = JSON.generate( { '_data' => response_array, '_dataset_size' => response_array.count } )
|
224
224
|
expect( status ).to eq( 200 )
|
225
225
|
expect( headers ).to eq( { 'Content-Length' => expected.length.to_s } )
|
226
|
-
expect( body
|
226
|
+
expect( body ).to eq( [ expected ] )
|
227
227
|
end
|
228
228
|
|
229
229
|
it 'returns non-error condition Rack data correctly with an estimated dataset size' do
|
@@ -235,7 +235,7 @@ describe Hoodoo::Services::Response do
|
|
235
235
|
expected = JSON.generate( { '_data' => response_array, '_estimated_dataset_size' => response_array.count } )
|
236
236
|
expect( status ).to eq( 200 )
|
237
237
|
expect( headers ).to eq( { 'Content-Length' => expected.length.to_s } )
|
238
|
-
expect( body
|
238
|
+
expect( body ).to eq( [ expected ] )
|
239
239
|
end
|
240
240
|
|
241
241
|
it 'returns non-error condition Rack data correctly with both an accurate and an estimated dataset size' do
|
@@ -252,7 +252,7 @@ describe Hoodoo::Services::Response do
|
|
252
252
|
|
253
253
|
expect( status ).to eq( 200 )
|
254
254
|
expect( headers ).to eq( { 'Content-Length' => expected.length.to_s } )
|
255
|
-
expect( body
|
255
|
+
expect( body ).to eq( [ expected ] )
|
256
256
|
end
|
257
257
|
|
258
258
|
it 'should allow pre-encoded strings in the body' do
|
@@ -261,7 +261,7 @@ describe Hoodoo::Services::Response do
|
|
261
261
|
status, headers, body = @r.for_rack
|
262
262
|
|
263
263
|
expect(status).to eq(200)
|
264
|
-
expect(body
|
264
|
+
expect(body).to eq(['Hello World!'])
|
265
265
|
end
|
266
266
|
|
267
267
|
it 'should raise an exception when the body is in an unsupported format' do
|
@@ -604,7 +604,7 @@ describe Hoodoo::Utilities do
|
|
604
604
|
end
|
605
605
|
|
606
606
|
after :each do
|
607
|
-
@old_tz.
|
607
|
+
(@old_tz.nil? || @old_tz == '') ? ENV.delete( 'TZ' ) : ENV[ 'TZ' ] = @old_tz
|
608
608
|
end
|
609
609
|
|
610
610
|
it 'accepts a non-UTC Time and renders a UTC date-time' do
|
@@ -678,11 +678,11 @@ describe Hoodoo::Utilities do
|
|
678
678
|
it 'rejects invalid input with an exception' do
|
679
679
|
expect {
|
680
680
|
Hoodoo::Utilities.rationalise_datetime( "hello" )
|
681
|
-
}.to raise_exception
|
681
|
+
}.to raise_exception( /Invalid parameter 'hello'/ )
|
682
682
|
|
683
683
|
expect {
|
684
684
|
Hoodoo::Utilities.rationalise_datetime( Array.new )
|
685
|
-
}.to raise_exception
|
685
|
+
}.to raise_exception( /Invalid parameter '\[\]'/ )
|
686
686
|
end
|
687
687
|
end
|
688
688
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoodoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.12.
|
4
|
+
version: 2.12.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loyalty New Zealand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -184,28 +184,28 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - "~>"
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: 5.2.4.3
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 5.2.4.3
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: activesupport
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 5.2.4.3
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 5.2.4.3
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: database_cleaner
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -598,8 +598,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
598
598
|
- !ruby/object:Gem::Version
|
599
599
|
version: '0'
|
600
600
|
requirements: []
|
601
|
-
|
602
|
-
rubygems_version: 2.7.7
|
601
|
+
rubygems_version: 3.1.4
|
603
602
|
signing_key:
|
604
603
|
specification_version: 4
|
605
604
|
summary: Opinionated APIs
|