lib/airborne/request_expectations.rb in airborne-0.0.19 vs lib/airborne/request_expectations.rb in airborne-0.0.20

- old
+ new

@@ -47,10 +47,14 @@ def optional(hash) OptionalHashTypeExpectations.new(hash) end + def regex(reg) + Regexp.new(reg) + end + private def call_with_path(args) if args.length == 2 get_by_path(args[0], json_body) do|json_chunk| @@ -113,13 +117,14 @@ actual_value = hash[prop_name] if expected_value.class == Hash expect_json_impl(expected_value, actual_value) elsif expected_value.class == Proc expected_value.call(actual_value) + elsif expected_value.class == Regexp + expect(actual_value).to match(expected_value) else - expect(expected_value).to eq(actual_value) + expect(actual_value).to eq(expected_value) end end end - end end \ No newline at end of file