Module: Airborne::Expectations

Defined in:
lib/airborne/expectations.rb

Overview

rubocop:todo Metrics/ModuleLength

Instance Method Summary collapse

Instance Method Details

#expect_header(key, content) ⇒ Object



36
37
38
# File 'lib/airborne/expectations.rb', line 36

def expect_header(key, content)
  expect_header_impl(key, content)
end

#expect_header_contains(key, content) ⇒ Object



40
41
42
# File 'lib/airborne/expectations.rb', line 40

def expect_header_contains(key, content)
  expect_header_impl(key, content, true)
end

#expect_json(*args) ⇒ Object



12
13
14
15
16
# File 'lib/airborne/expectations.rb', line 12

def expect_json(*args)
  call_with_path(args) do |param, body|
    expect_json_impl(param, body)
  end
end

#expect_json_keys(*args) ⇒ Object



18
19
20
21
22
# File 'lib/airborne/expectations.rb', line 18

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



24
25
26
27
28
# File 'lib/airborne/expectations.rb', line 24

def expect_json_sizes(*args)
  args.push(convert_expectations_for_json_sizes(args.pop))

  expect_json_types(*args)
end

#expect_json_types(*args) ⇒ Object



6
7
8
9
10
# File 'lib/airborne/expectations.rb', line 6

def expect_json_types(*args)
  call_with_path(args) do |param, body|
    expect_json_types_impl(param, body)
  end
end

#expect_status(code) ⇒ Object



30
31
32
33
34
# File 'lib/airborne/expectations.rb', line 30

def expect_status(code)
  code = Rack::Utils::SYMBOL_TO_STATUS_CODE[code] if code.is_a?(Symbol)

  expect(response.code.to_s).to eq(code.to_s)
end