Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with OJ 3.0 #138

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/airborne/path_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions lib/airborne/request_expectations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
expected = param
expected.map!(&:to_s) if expected.kind_of?(Array)

expect(body.keys).to include( *expected )
end
end

Expand Down Expand Up @@ -143,7 +146,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
Expand All @@ -160,7 +168,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
Expand Down