Sha256: f8698e5860e4161ab1cc455f1ce7bb93946ed6f1c9f73507350c0148117ccfa2

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 Bytes

Contents

# request_construction.rb - Build and send requests

When(/^the request body is assigned:$/) do |input|
  set_request_body(input)
end

When(/^the request query parameter `([^`]*)` is assigned `([^`]*)`$/) do |param, value|
  add_request_param(param, value)
end

When(/^the request header `([^`]*)` is assigned `([^`]*)`$/) do |header, value|
  add_header(header, value)
end

When(/^the request credentials are set for basic auth user `([^`]*)` and password `([^`]*)`$/) do |user, password|
  base64_combined = Base64.strict_encode64("#{user}:#{password}")
  add_header('Authorization', "Basic #{base64_combined}")
end

When(/^an? (GET|POST|PATCH|PUT|DELETE|HEAD|OPTIONS) is sent to `([^`]*)`$/) do |method, url|
  send_request(parse_method(method), URI.escape(url))
  bind('response', response)
  reset_request
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brine-dsl-0.9.0 lib/brine/step_definitions/request_construction.rb