From 99bf36582d890c2684a7d6b97d019ad8d2bc1b20 Mon Sep 17 00:00:00 2001 From: Kesha Antonov Date: Fri, 26 May 2017 14:09:34 +0300 Subject: [PATCH 1/5] fix_oj_3_compatibility --- lib/airborne/request_expectations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/airborne/request_expectations.rb b/lib/airborne/request_expectations.rb index cde9afb..01da2f3 100644 --- a/lib/airborne/request_expectations.rb +++ b/lib/airborne/request_expectations.rb @@ -160,7 +160,7 @@ def extract_expected_type(expected, prop) def extract_actual(actual, prop) begin - value = actual[prop] + value = actual[prop.to_s] rescue raise ExpectationError, "Expected #{actual.class} #{actual}\nto be an object with property #{prop}" end From cd281cdd74d8f184a330fb43011934f5d610149a Mon Sep 17 00:00:00 2001 From: Kesha Antonov Date: Fri, 26 May 2017 14:36:10 +0300 Subject: [PATCH 2/5] fix expect_json_sizes --- lib/airborne/path_matcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/airborne/path_matcher.rb b/lib/airborne/path_matcher.rb index 768a0f6..468da9a 100644 --- a/lib/airborne/path_matcher.rb +++ b/lib/airborne/path_matcher.rb @@ -54,7 +54,7 @@ def process_json(part, json) part = part.to_i json = json[part] else - json = json[part.to_sym] + json = json[part.to_s] end json end From bef1dc45f2ae3ff62355f6ec6e786b46ae3dbc8b Mon Sep 17 00:00:00 2001 From: Kesha Antonov Date: Fri, 26 May 2017 15:19:35 +0300 Subject: [PATCH 3/5] fix assert keys --- lib/airborne/request_expectations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/airborne/request_expectations.rb b/lib/airborne/request_expectations.rb index 01da2f3..9499e2b 100644 --- a/lib/airborne/request_expectations.rb +++ b/lib/airborne/request_expectations.rb @@ -22,7 +22,7 @@ def expect_json(*args) def expect_json_keys(*args) call_with_path(args) do |param, body| - expect(body.keys).to include(*param) + expect(body.keys).to include(*param.map(&:to_s)) end end From c740277bfa20d40941bc3cad61357a7a9f3d32c6 Mon Sep 17 00:00:00 2001 From: Kesha Antonov Date: Fri, 26 May 2017 15:41:42 +0300 Subject: [PATCH 4/5] fix expect_json with arrays --- lib/airborne/request_expectations.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/airborne/request_expectations.rb b/lib/airborne/request_expectations.rb index 9499e2b..1daa18f 100644 --- a/lib/airborne/request_expectations.rb +++ b/lib/airborne/request_expectations.rb @@ -143,7 +143,12 @@ def call_with_path(args) def extract_expected_value(expected, prop) begin raise unless expected.keys.include?(prop) - expected[prop] + + if expected[prop].kind_of?(Array) + expected[prop].map{|x| x.stringify_keys} + else + expected[prop] + end rescue raise ExpectationError, "Expectation is expected to contain property: #{prop}" end From 036f77291e7c907cca67df14adfaff57b66ba685 Mon Sep 17 00:00:00 2001 From: Kesha Antonov Date: Fri, 26 May 2017 18:07:49 +0300 Subject: [PATCH 5/5] fix parse array --- lib/airborne/request_expectations.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/airborne/request_expectations.rb b/lib/airborne/request_expectations.rb index 1daa18f..e00032e 100644 --- a/lib/airborne/request_expectations.rb +++ b/lib/airborne/request_expectations.rb @@ -22,7 +22,10 @@ def expect_json(*args) def expect_json_keys(*args) call_with_path(args) do |param, body| - expect(body.keys).to include(*param.map(&:to_s)) + expected = param + expected.map!(&:to_s) if expected.kind_of?(Array) + + expect(body.keys).to include( *expected ) end end