brine-dsl 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +0,0 @@
1
- # cleanup.rb - Track information needed for Resource Cleanup
2
- When(/^a resource is created at `([^`]*)`$/) do |path|
3
- perform { track_created_resource path }
4
- end
@@ -1,16 +0,0 @@
1
- ##
2
- # @file perform.rb
3
- # Steps related to performing actions
4
- ##
5
-
6
- When /^actions are defined such that$/ do
7
- collect_actions
8
- end
9
-
10
- Then /^the actions are( not)? successful within a `([^`]*)` period$/ do |negated, period|
11
- method = negated ? :to : :to_not
12
- expect { poll_for(retrieve_duration(period)) {
13
- performer.evaluate
14
- } }.send(method, raise_error)
15
- reset_performer
16
- end
@@ -1,28 +0,0 @@
1
- # request_construction.rb - Build and send requests
2
-
3
- When(/^the request body is assigned:$/) do |input|
4
- perform { set_request_body(input) }
5
- end
6
-
7
- When(/^the request query parameter `([^`]*)` is assigned `([^`]*)`$/) do |param, value|
8
- perform { set_request_param(param, value) }
9
- end
10
-
11
- When(/^the request header `([^`]*)` is assigned `([^`]*)`$/) do |header, value|
12
- perform { set_header(header, value) }
13
- end
14
-
15
- When(/^the request credentials are set for basic auth user `([^`]*)` and password `([^`]*)`$/) do |user, password|
16
- perform do
17
- base64_combined = Base64.strict_encode64("#{user}:#{password}")
18
- set_header('Authorization', "Basic #{base64_combined}")
19
- end
20
- end
21
-
22
- When(/^an? (GET|POST|PATCH|PUT|DELETE|HEAD|OPTIONS) is sent to `([^`]*)`$/) do |method, url|
23
- perform do
24
- send_request(parse_method(method), URI.escape(url))
25
- bind('response', response)
26
- reset_request
27
- end
28
- end
@@ -1,49 +0,0 @@
1
- #RESPONSE_ATTRIBUTES='(status|headers|body)'
2
- Then(/^the value of the response #{RESPONSE_ATTRIBUTES}(?: child(ren)? `([^`]*)`)? is( not)? (.*)(?<!:)$/) do
3
- |attribute, plural, path, negated, assertion|
4
- perform do
5
- select(dig_from_response(attribute, path, !plural.nil?), (!negated.nil?))
6
- step "it is #{assertion}"
7
- end
8
- end
9
-
10
- Then(/^the value of the response #{RESPONSE_ATTRIBUTES}(?: child(ren)? `([^`]*)`)? is( not)? (.*)(?<=:)$/) do
11
- |attribute, plural, path, negated, assertion, multi|
12
- perform do
13
- select(dig_from_response(attribute, path, !plural.nil?), (!negated.nil?))
14
- step "it is #{assertion}", multi.to_json
15
- end
16
- end
17
-
18
- Then(/^the value of the response #{RESPONSE_ATTRIBUTES}(?: child(ren)? `([^`]*)`)? does( not)? have any element that is (.*)(?<!:)$/) do
19
- |attribute, plural, path, negated, assertion|
20
- perform do
21
- select_any(dig_from_response(attribute, path, !plural.nil?), (!negated.nil?))
22
- step "it is #{assertion}"
23
- end
24
- end
25
-
26
- Then(/^the value of the response #{RESPONSE_ATTRIBUTES}(?: child(ren)? `([^`]*)`)? does( not)? have any element that is (.*)(?<=:)$/) do
27
- |attribute, plural, path, negated, assertion, multi|
28
- perform do
29
- select_any(dig_from_response(attribute, path, !plural.nil?), (!negated.nil?))
30
- step "it is #{assertion}", multi.to_json
31
- end
32
- end
33
-
34
- #Would be negated with `not all' which would be equivalent to any(not ) but that's not readily supported
35
- Then(/^the value of the response #{RESPONSE_ATTRIBUTES}(?: child(ren)? `([^`]*)`)? has elements which are all (.*)(?<!:)$/) do
36
- |attribute, plural, path, assertion|
37
- perform do
38
- select_all(dig_from_response(attribute, path, !plural.nil?), false)
39
- step "it is #{assertion}"
40
- end
41
- end
42
-
43
- Then(/^the value of the response #{RESPONSE_ATTRIBUTES}(?: child(ren)? `([^`]*)`)? has elements which are all (.*)(?<=:)$/) do
44
- |attribute, plural, path, assertion, multi|
45
- perform do
46
- select_all(dig_from_response(attribute, path, !plural.nil?), false)
47
- step "it is #{assertion}", multi.to_json
48
- end
49
- end
@@ -1,46 +0,0 @@
1
- # Assorted utility functions
2
- # The deprecation piece should be extracted and the rest considered dead.
3
- module BrineUtil
4
- # reevaluate passed block until it returns without throwing an exception
5
- # or `time` elapses; retry every `interval`
6
- def retry_for(time, interval=1)
7
- failure = nil
8
- quit = Time.now + time
9
- while (Time.now <= quit)
10
- begin
11
- return yield
12
- rescue Exception => ex
13
- failure = ex
14
- sleep interval
15
- end
16
- end
17
- raise failure
18
- end
19
-
20
- # iterate over data table and shave_value for each cell value
21
- # mutates and returns table
22
- # FIXME: Shouldn't be needed and removed after use of tables is dropped
23
- def transform_table!(table)
24
- table.cells_rows.each do |row|
25
- row.each{|cell| cell.value = Transform(cell.value)}
26
- end
27
- table
28
- end
29
- end
30
-
31
- def replaced_with(type, new_step, version, multiline=nil)
32
- deprecation_message(version, "Replace with: #{type} #{new_step}\n#{multiline}")
33
- step new_step, multiline
34
- end
35
-
36
- ##
37
- # Output a deprecation message with contents `msg`
38
- #
39
- # Nothing will be output if BRINE_QUIET_DEPRECATIONS is set.
40
- #
41
- # @param version [String] Version at which this feature will be removed.
42
- # @param message [String] The message to log.
43
- ##
44
- def deprecation_message(version, message)
45
- warn "DEPRECATION - Removal planned for #{version}: #{message}" unless ENV['BRINE_QUIET_DEPRECATIONS']
46
- end