Module: Airborne::RequestExpectations
Instance Method Summary collapse
- #date ⇒ Object
- #expect_header(key, content) ⇒ Object
- #expect_header_contains(key, content) ⇒ Object
- #expect_json(*args) ⇒ Object
- #expect_json_keys(*args) ⇒ Object
- #expect_json_sizes(*args) ⇒ Object
- #expect_json_types(*args) ⇒ Object
- #expect_status(code) ⇒ Object
- #optional(hash) ⇒ Object
- #regex(reg) ⇒ Object
Methods included from PathMatcher
Instance Method Details
#date ⇒ Object
55 56 57 |
# File 'lib/airborne/request_expectations.rb', line 55 def date ->(value) { yield DateTime.parse(value) } end |
#expect_header(key, content) ⇒ Object
39 40 41 |
# File 'lib/airborne/request_expectations.rb', line 39 def expect_header(key, content) expect_header_impl(key, content) end |
#expect_header_contains(key, content) ⇒ Object
43 44 45 |
# File 'lib/airborne/request_expectations.rb', line 43 def expect_header_contains(key, content) expect_header_impl(key, content, true) end |
#expect_json(*args) ⇒ Object
17 18 19 20 21 |
# File 'lib/airborne/request_expectations.rb', line 17 def expect_json(*args) call_with_path(args) do |param, body| expect_json_impl(param, body) end end |
#expect_json_keys(*args) ⇒ Object
23 24 25 26 27 |
# File 'lib/airborne/request_expectations.rb', line 23 def expect_json_keys(*args) call_with_path(args) do |param, body| expect(body.keys).to include(*param) end end |
#expect_json_sizes(*args) ⇒ Object
29 30 31 32 33 |
# File 'lib/airborne/request_expectations.rb', line 29 def expect_json_sizes(*args) args.push(convert_expectations_for_json_sizes(args.pop)) expect_json_types(*args) end |
#expect_json_types(*args) ⇒ Object
11 12 13 14 15 |
# File 'lib/airborne/request_expectations.rb', line 11 def expect_json_types(*args) call_with_path(args) do |param, body| expect_json_types_impl(param, body) end end |
#expect_status(code) ⇒ Object
35 36 37 |
# File 'lib/airborne/request_expectations.rb', line 35 def expect_status(code) expect(response.code).to eq(resolve_status(code, response.code)) end |
#optional(hash) ⇒ Object
47 48 49 |
# File 'lib/airborne/request_expectations.rb', line 47 def optional(hash) OptionalHashTypeExpectations.new(hash) end |
#regex(reg) ⇒ Object
51 52 53 |
# File 'lib/airborne/request_expectations.rb', line 51 def regex(reg) Regexp.new(reg) end |