Top Level Namespace

Defined Under Namespace

Modules: Brine, BrineUtil, CleanerUpper, ClientBuilding, Coercion, MustacheBinder, Requesting, Selection, TypeChecking Classes: AllSelector, AnySelector, ClientBuilder, Coercer, DeleteCommand, OAuth2Params, Requester, ResponseStatusSequenceStubBuilder, Selector, StubBuilder, StubRequest, StubResponse, TypeChecks

Constant Summary collapse

RESPONSE_ATTRIBUTES =

Steps

'(status|headers|body)'
HTTP_METHOD =

Not loaded by default (except in the tests)

'GET|POST|PATCH|PUT|DELETE|HEAD|OPTIONS'
DATE =

Temporal

'\d{4}-\d{2}-\d{2}'
TIME =
'\d{2}:\d{2}:\d{2}'
MILLIS =
'(?:\.\d{3})?'
TZ =
'(?:Z|(?:[+-]\d{2}:\d{2}))'

Instance Method Summary collapse

Instance Method Details

#brine_mixObject

Load the more side effecty files and return the Module, expected to be called as ‘World(brine_mix)`



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/brine.rb', line 28

def brine_mix
  require 'brine/step_definitions/assignment'
  require 'brine/step_definitions/request_construction'
  require 'brine/step_definitions/assertions'
  require 'brine/step_definitions/cleanup'
  require 'brine/step_definitions/selection'

  require 'brine/transforms'
  require 'brine/rest_steps'
  require 'brine/hooks'
  Brine
end

#build_stubObject



77
78
79
80
# File 'lib/brine/test_steps.rb', line 77

def build_stub
  stub.build($stubs)
  @stub = nil
end

#dig_from_response(attribute, path = nil, plural = false) ⇒ Object



62
63
64
65
66
# File 'lib/brine/selector.rb', line 62

def dig_from_response(attribute, path=nil, plural=false)
  root = response.send(attribute.to_sym)
  return root if !path
  JsonPath.new("$.#{path}").send(plural ? :on : :first, root)
end

#kv_table(table) ⇒ Object

Return a table that that is a key value pair in a format ready for consumption



32
33
34
# File 'lib/brine/rest_steps.rb', line 32

def kv_table(table)
  transform_table!(table).rows_hash
end

#not_if(val) ⇒ Object

This file is legacy or unsorted steps which will be deprecated or moved into more appropriate homes



29
# File 'lib/brine/rest_steps.rb', line 29

def not_if(val) val ? :not_to : :to end

#replaced_with(type, new_step, version, multiline = nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/brine/util.rb', line 30

def replaced_with(type, new_step, version, multiline=nil)
  warn """
DEPRECATION: This step will be removed in version #{version}. Replace with:
#{type} #{new_step}\n#{multiline}""" unless ENV['BRINE_QUIET_DEPRECATIONS']
  step new_step, multiline
end

#response_body_child(path = "") ⇒ Object



136
137
138
# File 'lib/brine/rest_steps.rb', line 136

def response_body_child(path="")
  JsonPath.new("$.#{path}").on(response.body.to_json)
end

#stubObject



73
74
75
# File 'lib/brine/test_steps.rb', line 73

def stub
  @stub ||= StubBuilder.new
end