airborne 0.2.4 → 0.2.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d37e2129aab722cff3dd2400b133608e32df8c7
4
- data.tar.gz: 082f2802b2347baab25c4ea0e39237c6730f5ade
3
+ metadata.gz: 67b6c4aa3a5074c42780d4b4bb30797974f34a29
4
+ data.tar.gz: 861430f53bbd74076c161d4f6a0fa3e392b143e4
5
5
  SHA512:
6
- metadata.gz: 3ecf6b2916ef3396883a15747c877bd50cb76346cc28d2b9fc45ebf4ba62f8c26586257f7b2a711a3cfc91f579987b8a50e1aaa70fbcfbf0e7c749d7d422e3ee
7
- data.tar.gz: cba3ed6fcc10d6cf1612dfc66679cac3af45883ffd196acba0baa3f373f213fd233303628f2b4baf49602f07ef6df0b400608f99f05fd325589946ca2844816d
6
+ metadata.gz: f9fc7bdf5b0da1a85f9c6a72692b2b5966bebfcadbfeb647f3fe256e63656bd5c7ef24033ac5b6299305af8625b630c5a4d686a021e9ba964d0cd9d7319b8560
7
+ data.tar.gz: a08ff15e1f22d82cca5c7685ea4114c8c6399c7c6742f6b8d1740e3662fd314e47ba3c32fb7a6caa778f1f262736b748d65fa410a24e1bf401a9c364fd65c33f
data/airborne.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'airborne'
3
- s.version = '0.2.4'
3
+ s.version = '0.2.5'
4
4
  s.date = Date.today.to_s
5
5
  s.summary = 'RSpec driven API testing framework'
6
6
  s.authors = ['Alex Friedman', 'Seth Pollack']
@@ -124,7 +124,7 @@ module Airborne
124
124
 
125
125
  type_string = type.to_s
126
126
 
127
- if type_string.include?('array_of') && !type_string.include?('or_null')
127
+ if type_string.include?('array_of') && !(type_string.include?('or_null') && value.nil?)
128
128
  check_array_types(value, val_class, prop, type)
129
129
  else
130
130
  expect_type(type, val_class, prop)
@@ -38,17 +38,31 @@ describe 'expect_json_types' do
38
38
  end
39
39
 
40
40
  it "should allow array of types to be null" do
41
- mock_get('simple_get')
42
- get '/simple_get'
43
- expect_json_types(address: :array_or_null)
44
- expect_json_types(address: :array_of_integers_or_null)
45
- expect_json_types(address: :array_of_ints_or_null)
46
- expect_json_types(address: :array_of_floats_or_null)
47
- expect_json_types(address: :array_of_strings_or_null)
48
- expect_json_types(address: :array_of_booleans_or_null)
49
- expect_json_types(address: :array_of_bools_or_null)
50
- expect_json_types(address: :array_of_objects_or_null)
51
- expect_json_types(address: :array_of_arrays_or_null)
41
+ mock_get('array_of_types')
42
+ get '/array_of_types'
43
+ expect_json_types(nil_array: :array_or_null)
44
+ expect_json_types(nil_array: :array_of_integers_or_null)
45
+ expect_json_types(nil_array: :array_of_ints_or_null)
46
+ expect_json_types(nil_array: :array_of_floats_or_null)
47
+ expect_json_types(nil_array: :array_of_strings_or_null)
48
+ expect_json_types(nil_array: :array_of_booleans_or_null)
49
+ expect_json_types(nil_array: :array_of_bools_or_null)
50
+ expect_json_types(nil_array: :array_of_objects_or_null)
51
+ expect_json_types(nil_array: :array_of_arrays_or_null)
52
+ end
53
+
54
+ it "should check array types when not null" do
55
+ mock_get('array_of_types')
56
+ get '/array_of_types'
57
+ expect_json_types(array_of_ints: :array_or_null)
58
+ expect_json_types(array_of_ints: :array_of_integers_or_null)
59
+ expect_json_types(array_of_ints: :array_of_ints_or_null)
60
+ expect_json_types(array_of_floats: :array_of_floats_or_null)
61
+ expect_json_types(array_of_strings: :array_of_strings_or_null)
62
+ expect_json_types(array_of_bools: :array_of_booleans_or_null)
63
+ expect_json_types(array_of_bools: :array_of_bools_or_null)
64
+ expect_json_types(array_of_objects: :array_of_objects_or_null)
65
+ expect_json_types(array_of_arrays: :array_of_arrays_or_null)
52
66
  end
53
67
 
54
68
  it 'should allow empty array' do
@@ -0,0 +1,9 @@
1
+ {
2
+ "array_of_ints": [1,2,3],
3
+ "array_of_floats": [1.2, 2.2, 3.3],
4
+ "array_of_strings": ["one", "two", "three"],
5
+ "array_of_bools": [true, false, true],
6
+ "array_of_objects": [{}, {}, {}],
7
+ "array_of_arrays": [[], [], []],
8
+ "nil_array": null
9
+ }
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.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Friedman
@@ -151,6 +151,7 @@ files:
151
151
  - spec/airborne/rack/rack_sinatra_spec.rb
152
152
  - spec/spec_helper.rb
153
153
  - spec/stub_helper.rb
154
+ - spec/test_responses/array_of_types.json
154
155
  - spec/test_responses/array_of_values.json
155
156
  - spec/test_responses/array_response.json
156
157
  - spec/test_responses/array_with_index.json