Skip to content

Commit 6f3939e

Browse files
committed
[CI] Test Runner: Adds the option for a hash value in set parameters
1 parent c2aeee5 commit 6f3939e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

api-spec-testing/test_file/action.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,14 @@ def prepare_arguments(args, test)
111111
# Find the cached values where the variable name is contained in the arguments.
112112
if(cached_values = test.cached_values.keys.select { |k| value =~ /\$\{?#{k}\}?/ })
113113
cached_values.each do |cached|
114-
# The arguments may contain the variable in the form ${variable} or $variable
115-
value.gsub!(/\$\{?#{cached}\}?/, test.cached_values[cached].to_s)
114+
# Arguments can be $variable, ${variable} or a Hash:
115+
retrieved = test.cached_values[cached]
116+
if retrieved.is_a?(Hash)
117+
value = retrieved
118+
else
119+
# Regex substitution to replace ${variable} or $variable for the value
120+
value.gsub!(/\$\{?#{cached}\}?/, retrieved.to_s)
121+
end
116122
end
117123
args[key] = value
118124
end

0 commit comments

Comments
 (0)