Top Level Namespace

Defined Under Namespace

Modules: Brine Classes: DelayedStubResponse, ResponseStatusSequenceStubBuilder, StubBuilder, StubRequest, StubResponse

Instance Method Summary collapse

Instance Method Details

#assertionObject

Extract assertion step text.



213
214
215
216
217
218
# File 'lib/brine/selecting.rb', line 213

ParameterType(
  name: 'assertion',
  regexp: /.*[^:]/,
  transformer: -> (input) { input },
  use_for_snippets: false
)

#brine_mixmodule

Load all Brine files into the World.

Expected to be called as ‘World(brine_mix)`

Returns:

  • (module)

    Return the ‘Brine` module.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/brine.rb', line 13

def brine_mix
  require 'brine/assertions'
  require 'brine/assigning'
  require 'brine/cleaning_up'
  require 'brine/hooks'
  require 'brine/mustache_expanding'
  require 'brine/performing'
  require 'brine/requesting'
  require 'brine/selecting'
  require 'brine/transforming'
  require 'brine/type_checking'
  Brine
end

#build_stubObject



95
96
97
98
# File 'lib/brine/test_steps.rb', line 95

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

#grave_paramObject

Transform grave accent delimited parameters, performing implicit type transformation.



173
174
175
176
177
# File 'lib/brine/transforming.rb', line 173

ParameterType(
  name: 'grave_param',
  regexp: /`([^`]*)`/,
  transformer: -> (input) { transformed_parameter(input) }
)

#http_methodObject

Extract the text for a standard HTTP method.



223
224
225
226
227
# File 'lib/brine/selecting.rb', line 223

ParameterType(
  name: 'http_method',
  regexp: /(DELETE|GET|HEAD|OPTIONS|PATCH|POST|PUT)/,
  transformer: -> (input) { input }
)

#maybe_notObject

Indicate whether not is present.



232
233
234
235
236
# File 'lib/brine/selecting.rb', line 232

ParameterType(
  name: 'maybe_not',
  regexp: /( not)?/,
  transformer: -> (input=nil) { !input.nil? }
)

#response_attribute(attribute) ⇒ Object

Extract the text for a supported response attribute.



205
206
207
# File 'lib/brine/selecting.rb', line 205

def response_attribute(attribute)
  response.send(attribute.to_sym)
end

#stubObject



91
92
93
# File 'lib/brine/test_steps.rb', line 91

def stub
  @stub ||= StubBuilder.new
end

#traversalObject

Produce a Traversal for one or all elements at the specified path.



253
254
255
256
257
258
259
260
261
262
263
# File 'lib/brine/selecting.rb', line 253

ParameterType(
  name: 'traversal',
  regexp: /(?: child(ren)? `([^`]*)`)?/,
  transformer: -> (plural_or_path=nil, path=nil) {
    if path.nil?
      path=plural_or_path
      plural_or_path=nil
    end
    traversal(path, plural_or_path)
  }
)