airborne 0.1.9 → 0.1.10

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: 9029133bcf1f37e86472d7066159149ccf633423
4
- data.tar.gz: 3490ccda6ffafc06a41173f5ba7767c249e589c3
3
+ metadata.gz: 7f3a95dbd602655f5f9912cf0dd7c4e09be76368
4
+ data.tar.gz: b72232f7b1ca118d77a9c0bd9b42dea8cc6e7674
5
5
  SHA512:
6
- metadata.gz: efad782993756790afe2fb8cc09503f891f9e4ade418ff70ede1d1811c0d6d4815d64485a13289e7bb55dd51827081376e8c6a5fad90bcd6681bb9c2ddb2808f
7
- data.tar.gz: 4f0b6884c93854ea614bc58680c5185a06d7295083ab6d1f61e570284e799ac44b0cd06cbc8c731f4fb959ef0bd746f6b4cb9e446259e32d05033d57e891e685
6
+ metadata.gz: b964ae3224bfba3a4db3534db6b241478743742efc8e5507f9f68a3ba25b5bb5f87b6c6f8b60af625c2ffcae5e0cad9147907751af40c52b9c315ce8a68b0deb
7
+ data.tar.gz: 1301b091fa0d7a1119147738427091d131101d4a4fbb0c63c1af13d4dfe6a809be041a540eb31fff65e4c03ef689a82fb7c1ffe942b1a3c9e1da2daef26ae99f
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'airborne'
3
- s.version = '0.1.9'
4
- s.date = '2014-12-10'
3
+ s.version = '0.1.10'
4
+ s.date = '2015-01-06'
5
5
  s.summary = "RSpec driven API testing framework"
6
6
  s.authors = ["Alex Friedman", "Seth Pollack"]
7
7
  s.email = ['a.friedman07@gmail.com', 'teampollack@gmail.com']
@@ -3,7 +3,7 @@ module Airborne
3
3
  module PathMatcher
4
4
 
5
5
  def get_by_path(path, json, &block)
6
- raise PathError, "Ivalid Path, contains '..'" if /\.\./ =~ path
6
+ raise PathError, "Invalid Path, contains '..'" if /\.\./ =~ path
7
7
  type = false
8
8
  parts = path.split('.')
9
9
  parts.each_with_index do |part, index|
@@ -51,7 +51,7 @@ module Airborne
51
51
  end
52
52
 
53
53
  def process_json(part, json)
54
- if is_index?(part)
54
+ if is_index?(part) && json.is_a?(Array)
55
55
  part = part.to_i
56
56
  json = json[part]
57
57
  else
@@ -2,20 +2,35 @@ require 'spec_helper'
2
2
 
3
3
  describe 'expect path' do
4
4
 
5
- before :each do
6
- mock_get('array_with_index')
7
- get '/array_with_index'
5
+ describe "errors" do
6
+ before :each do
7
+ mock_get('array_with_index')
8
+ get '/array_with_index'
9
+ end
10
+
11
+ it "should raise PathError when incorrect path containing .. is used" do
12
+ expect do
13
+ expect_json('cars..make', "Tesla")
14
+ end.to raise_error(Airborne::PathError, "Invalid Path, contains '..'")
15
+ end
16
+
17
+ it "should raise PathError when trying to call property on an array" do
18
+ expect do
19
+ expect_json('cars.make', "Tesla")
20
+ end.to raise_error(Airborne::PathError, "Expected Array\nto to be an object with property make")
21
+ end
8
22
  end
9
23
 
10
- it "should raise PathError when incorrect path containing .. is used" do
11
- expect do
12
- expect_json('cars..make', "Tesla")
13
- end.to raise_error(Airborne::PathError, "Ivalid Path, contains '..'")
24
+ it "should work with numberic properties" do
25
+ mock_get('numeric_property')
26
+ get '/numeric_property'
27
+ expect_json('cars.0.make', "Tesla")
14
28
  end
15
29
 
16
- it "should raise PathError when trying to call property on an array" do
17
- expect do
18
- expect_json('cars.make', "Tesla")
19
- end.to raise_error(Airborne::PathError, "Expected Array\nto to be an object with property make")
30
+ it "should work with numberic properties" do
31
+ mock_get('numeric_property')
32
+ get '/numeric_property'
33
+ expect_json_keys('cars.0',[:make, :model])
20
34
  end
35
+
21
36
  end
@@ -0,0 +1,6 @@
1
+ {
2
+ "cars": {
3
+ "0": {"make": "Tesla", "model": "Model S"},
4
+ "1": {"make": "Lamborghini", "model": "Aventador"}
5
+ }
6
+ }
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.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Friedman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-10 00:00:00.000000000 Z
12
+ date: 2015-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -155,6 +155,7 @@ files:
155
155
  - spec/test_responses/array_with_nested_bad_data.json
156
156
  - spec/test_responses/date_response.json
157
157
  - spec/test_responses/invalid_get.json
158
+ - spec/test_responses/numeric_property.json
158
159
  - spec/test_responses/simple_get.json
159
160
  - spec/test_responses/simple_json.json
160
161
  - spec/test_responses/simple_nested_path.json