Top Level Namespace
Defined Under Namespace
Modules: Brine, BrineUtil Classes: DelayedStubResponse, ResponseStatusSequenceStubBuilder, StubBuilder, StubRequest, StubResponse
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
-
#brine_mix ⇒ module
Load the files with side effects.
- #build_stub ⇒ Object
-
#deprecation_message(version, message) ⇒ Object
Output a deprecation message with contents ‘msg`.
- #dig_from_response(attribute, path = nil, plural = false) ⇒ Object
-
#kv_table(table) ⇒ Object
Return a table that that is a key value pair in a format ready for consumption.
-
#not_if(val) ⇒ Object
This file is legacy or unsorted steps which will be deprecated or moved into more appropriate homes.
- #replaced_with(type, new_step, version, multiline = nil) ⇒ Object
- #response_body_child(path = "") ⇒ Object
- #stub ⇒ Object
Instance Method Details
#brine_mix ⇒ module
Load the files with side effects.
Expected to be called as ‘World(brine_mix)`
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/brine.rb', line 25 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/perform' require 'brine/step_definitions/selection' require 'brine/transforms' require 'brine/hooks' Brine end |
#build_stub ⇒ Object
94 95 96 97 |
# File 'lib/brine/test_steps.rb', line 94 def build_stub stub.build($stubs) @stub = nil end |
#deprecation_message(version, message) ⇒ Object
Output a deprecation message with contents ‘msg`
Nothing will be output if BRINE_QUIET_DEPRECATIONS is set.
44 45 46 |
# File 'lib/brine/util.rb', line 44 def (version, ) warn "DEPRECATION - Removal planned for #{version}: #{message}" unless ENV['BRINE_QUIET_DEPRECATIONS'] end |
#dig_from_response(attribute, path = nil, plural = false) ⇒ Object
162 163 164 165 166 |
# File 'lib/brine/selecting.rb', line 162 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
37 38 39 |
# File 'lib/brine/rest_steps.rb', line 37 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
34 |
# File 'lib/brine/rest_steps.rb', line 34 def not_if(val) val ? :not_to : :to end |
#replaced_with(type, new_step, version, multiline = nil) ⇒ Object
31 32 33 34 |
# File 'lib/brine/util.rb', line 31 def replaced_with(type, new_step, version, multiline=nil) (version, "Replace with: #{type} #{new_step}\n#{multiline}") step new_step, multiline end |
#response_body_child(path = "") ⇒ Object
117 118 119 |
# File 'lib/brine/rest_steps.rb', line 117 def response_body_child(path="") JsonPath.new("$.#{path}").on(response.body.to_json) end |
#stub ⇒ Object
90 91 92 |
# File 'lib/brine/test_steps.rb', line 90 def stub @stub ||= StubBuilder.new end |