airborne 0.2.11 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a17018ee960799abaabe77e8e53cd7933b1c256
4
- data.tar.gz: 5ffee8561f16813ed64b2d58feabc054a0c7e27a
3
+ metadata.gz: c07d38bc345ad7e0ce8ad75b082d7bc03164e366
4
+ data.tar.gz: 03c380223cfd705875f0c9b0606dba3d1bde0f78
5
5
  SHA512:
6
- metadata.gz: 391e4cc6d0a84acbd86b88aeece81812a29e6beb045512973d2b7fb7d65dcbc8cd2a79ce338252e9a4ea91e3214d7ef5fd93d4c2fb88cfea92076e97cbd1f196
7
- data.tar.gz: 37babe87aaa640f11b246b8b7177baa2e230a1fc1189d6d6bb447a6ba49b6396be9ebd50c46c0befbdce51dc3253d452833467d6caa7886f260fdc1abc5a8c2f
6
+ metadata.gz: e17756d80dc4ee9e6fcf21e5afc5e0b8593bb3a87dac08588c7a9bceb08d87ba313f44d374b93dad7607ce8ac48bd0f6c074b4efb5c2fa68e9892cc7778cc0fb
7
+ data.tar.gz: 2e0385cc539038f6f8ce637b636d0906e8be4e05f628dbcff8fc23cb6a5f1122d992ae4c8abdf4bfb052188fc249b7665f53aec23621bdb778fbffda4febe007
@@ -2,7 +2,7 @@ require 'date'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'airborne'
5
- s.version = '0.2.11'
5
+ s.version = '0.2.12'
6
6
  s.date = Date.today.to_s
7
7
  s.summary = 'RSpec driven API testing framework'
8
8
  s.authors = ['Alex Friedman', 'Seth Pollack']
@@ -101,7 +101,7 @@ module Airborne
101
101
 
102
102
  @mapper ||= get_mapper
103
103
 
104
- actual = convert_to_date(actual) if expected == :date
104
+ actual = convert_to_date(actual) if ((expected == :date) || (expected == :date_or_null))
105
105
 
106
106
  return expect_type(expected, actual) if expected.is_a?(Symbol)
107
107
  return expected.call(actual) if expected.is_a?(Proc)
@@ -115,7 +115,7 @@ module Airborne
115
115
  keys.flatten.uniq.each do |prop|
116
116
  type = extract_expected_type(expected, prop)
117
117
  value = extract_actual(actual, prop)
118
- value = convert_to_date(value) if type == :date
118
+ value = convert_to_date(value) if ((type == :date) || (type == :date_or_null))
119
119
 
120
120
  next expect_json_types_impl(type, value) if hash?(type)
121
121
  next type.call(value) if type.is_a?(Proc)
@@ -24,3 +24,29 @@ describe 'expect_json with date' do
24
24
  expect_json(createdAt: date { |value| expect(value).to be_between(prev_day, next_day) })
25
25
  end
26
26
  end
27
+
28
+ describe 'expect_json_types with date_or_null' do
29
+ it 'should verify date_or_null when date is null' do
30
+ mock_get('date_is_null_response')
31
+ get '/date_is_null_response'
32
+ expect_json_types(dateDeleted: :date_or_null)
33
+ end
34
+
35
+ it 'should verify date_or_null when date is null with path' do
36
+ mock_get('date_is_null_response')
37
+ get '/date_is_null_response'
38
+ expect_json_types('dateDeleted', :date_or_null)
39
+ end
40
+
41
+ it 'should verify date_or_null with date' do
42
+ mock_get('date_response')
43
+ get '/date_response'
44
+ expect_json_types(createdAt: :date_or_null)
45
+ end
46
+
47
+ it 'should verify date_or_null with date with path' do
48
+ mock_get('date_response')
49
+ get '/date_response'
50
+ expect_json_types('createdAt', :date_or_null)
51
+ end
52
+ end
@@ -0,0 +1,3 @@
1
+ {
2
+ "dateDeleted": null
3
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airborne
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Friedman
@@ -166,6 +166,7 @@ files:
166
166
  - spec/test_responses/array_with_nested.json
167
167
  - spec/test_responses/array_with_nested_bad_data.json
168
168
  - spec/test_responses/array_with_partial_nested.json
169
+ - spec/test_responses/date_is_null_response.json
169
170
  - spec/test_responses/date_response.json
170
171
  - spec/test_responses/hash_property.json
171
172
  - spec/test_responses/invalid_get.json