Module: Airborne::RequestExpectations

Defined in:
lib/spaceborne.rb

Overview

Extend airborne’s expectations

Instance Method Summary collapse

Instance Method Details

#call_with_relative_path(data, args) ⇒ Object



137
138
139
140
141
142
143
144
145
# File 'lib/spaceborne.rb', line 137

def call_with_relative_path(data, args)
  if args.length == 2
    get_by_path(args[0], data) do |json_chunk|
      yield(args[1], json_chunk)
    end
  else
    yield(args[0], data)
  end
end

#expect_header(*args) ⇒ Object



165
166
167
168
169
# File 'lib/spaceborne.rb', line 165

def expect_header(*args)
  call_with_relative_path(response.headers, args) do |param, body|
    expect_json_impl(param, body)
  end
end

#expect_header_types(*args) ⇒ Object



159
160
161
162
163
# File 'lib/spaceborne.rb', line 159

def expect_header_types(*args)
  call_with_relative_path(response.headers, args) do |param, body|
    expect_json_types_impl(param, body)
  end
end

#expect_json(*args) ⇒ Object



153
154
155
156
157
# File 'lib/spaceborne.rb', line 153

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

#expect_json_types(*args) ⇒ Object



147
148
149
150
151
# File 'lib/spaceborne.rb', line 147

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