Fixed the rest of the minitest deprecations by removing FuncTestRunResult.

Folded the json & other payloads into plain ivars on the test.
Found and removed some unused code while I was there.

Fixes #4533.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-10-21 16:13:03 -07:00
parent aebcd3c119
commit d201d1fbc2
13 changed files with 81 additions and 119 deletions

View file

@ -9,7 +9,7 @@ module PluginManagerHelpers
let(:list_after_run) do
Proc.new do |run_result, tmp_dir|
# After installing/uninstalling/whatevering, run list with config in the same dir, and capture it.
run_result.payload.list_result = parse_plugin_list_lines(
@list_result = parse_plugin_list_lines(
run_inspec_process("plugin list", env: { INSPEC_CONFIG_DIR: tmp_dir }).stdout
)
end

View file

@ -54,12 +54,12 @@ class PluginManagerCliInstall < Minitest::Test
assert_includes success_message, "plugin installed via source path reference"
# Check round-trip UX via list
itf_plugin = install_result.payload.list_result.detect { |p| p[:name] == fixture_info[:plugin_name] }
itf_plugin = @list_result.detect { |p| p[:name] == fixture_info[:plugin_name] }
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
assert_equal "path", itf_plugin[:type], "list output should show that it is a path installation"
# Check plugin statefile. Extra important in this case, since all should resolve to the same entry point.
plugin_data = install_result.payload.plugin_data
plugin_data = @plugin_data
entry = plugin_data["plugins"].detect { |e| e["name"] == fixture_info[:plugin_name] }
assert_equal fixture_info[:resolved_path], entry["installation_path"], "Regardless of input, the entry point should be correct."
@ -164,7 +164,7 @@ class PluginManagerCliInstall < Minitest::Test
refute_nil success_message, "Should find a success message at the end"
assert_includes success_message, "installed from local .gem file"
itf_plugin = install_result.payload.list_result.detect { |p| p[:name] == "inspec-test-fixture" }
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
assert_equal "gem (user)", itf_plugin[:type]
assert_equal "0.1.0", itf_plugin[:version]
@ -195,7 +195,7 @@ class PluginManagerCliInstall < Minitest::Test
assert_includes success_message, "0.2.0"
assert_includes success_message, "installed from rubygems.org"
itf_plugin = install_result.payload.list_result.detect { |p| p[:name] == "inspec-test-fixture" }
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
assert_equal "gem (user)", itf_plugin[:type]
assert_equal "0.2.0", itf_plugin[:version]
@ -225,7 +225,7 @@ class PluginManagerCliInstall < Minitest::Test
assert_includes success_message, "0.1.0"
assert_includes success_message, "installed from rubygems.org"
itf_plugin = install_result.payload.list_result.detect { |p| p[:name] == "inspec-test-fixture" }
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
assert_equal "gem (user)", itf_plugin[:type]
assert_equal "0.1.0", itf_plugin[:version]
@ -317,7 +317,7 @@ class PluginManagerCliInstall < Minitest::Test
assert_includes success_message, "0.1.0"
assert_includes success_message, "installed from rubygems.org"
ttf_plugin = install_result.payload.list_result.detect { |p| p[:name] == "train-test-fixture" }
ttf_plugin = @list_result.detect { |p| p[:name] == "train-test-fixture" }
refute_nil ttf_plugin, "plugin name should now appear in the output of inspec list"
assert_equal "gem (user)", ttf_plugin[:type]
assert_equal "0.1.0", ttf_plugin[:version]

View file

@ -20,7 +20,7 @@ class PluginManagerCliUninstall < Minitest::Test
assert_includes success_message, "0.1.0"
assert_includes success_message, "has been uninstalled"
itf_plugins = uninstall_result.payload.list_result.select { |p| p[:name] == "inspec-test-fixture" }
itf_plugins = @list_result.select { |p| p[:name] == "inspec-test-fixture" }
assert_empty itf_plugins, "inspec-test-fixture should not appear in the output of inspec list"
assert_empty uninstall_result.stderr
@ -42,7 +42,7 @@ class PluginManagerCliUninstall < Minitest::Test
assert_includes success_message, "path-based plugin install"
assert_includes success_message, "has been uninstalled"
itf_plugins = uninstall_result.payload.list_result.select { |p| p[:name] == "inspec-meaning-of-life" }
itf_plugins = @list_result.select { |p| p[:name] == "inspec-meaning-of-life" }
assert_empty itf_plugins, "inspec-meaning-of-life should not appear in the output of inspec list"
assert_empty uninstall_result.stderr

View file

@ -22,7 +22,7 @@ class PluginManagerCliUpdate < Minitest::Test
assert_includes success_message, "0.2.0"
assert_includes success_message, "updated from rubygems.org"
itf_plugin = update_result.payload.list_result.detect { |p| p[:name] == "inspec-test-fixture" }
itf_plugin = @list_result.detect { |p| p[:name] == "inspec-test-fixture" }
refute_nil itf_plugin, "plugin name should now appear in the output of inspec list"
assert_equal "gem (user)", itf_plugin[:type]
assert_equal "0.2.0", itf_plugin[:version]

View file

@ -65,7 +65,7 @@ module CorePluginFunctionalHelper
elsif opts.key?(:env)
prefix = opts[:env].to_a.map { |assignment| "#{assignment[0]}=#{assignment[1]}" }.join(" ")
end
Inspec::FuncTestRunResult.new(TRAIN_CONNECTION.run_command("#{prefix} #{exec_inspec} #{command_line}"))
TRAIN_CONNECTION.run_command("#{prefix} #{exec_inspec} #{command_line}")
end
# This helper does some fancy footwork to make InSpec think a plugin
@ -76,8 +76,7 @@ module CorePluginFunctionalHelper
# Modify plugin_statefile_data as needed; it will be written to a plugins.json
# in tmp_dir_path. You may also copy in other things to the tmp_dir_path. Your PWD
# will be in the tmp_dir, and it will exist and be empty.
# :post_run: Proc(FuncTestRunResult, tmp_dir_path) - optional result capture block.
# run_result will be populated, but you can add more to the ostruct .payload
# :post_run: Proc(CommandResult, tmp_dir_path) - optional result capture block.
# Your PWD will be the tmp_dir, and it will still exist (for a moment!)
def run_inspec_process_with_this_plugin(command_line, opts = {})
plugin_path = __find_plugin_path_from_caller
@ -101,7 +100,7 @@ module CorePluginFunctionalHelper
# Read the resulting plugins.json into memory, if any
if File.exist?(plugin_file_path)
run_result.payload.plugin_data = JSON.parse(File.read(plugin_file_path))
@plugin_data = JSON.parse(File.read(plugin_file_path))
end
opts[:post_run]&.call(run_result, tmp_dir)

View file

@ -11,7 +11,7 @@ describe "filtertable functional tests" do
end
def failed_control_test_outcomes(run_result)
failed_controls = run_result.payload.json["profiles"][0]["controls"].select { |ctl| ctl["results"][0]["status"] == "failed" }
failed_controls = @json["profiles"][0]["controls"].select { |ctl| ctl["results"][0]["status"] == "failed" }
# Re-package any failed controls into a hash mapping control_id => message
# We will later test against this, as it provides more informative test output
@ -37,7 +37,7 @@ describe "filtertable functional tests" do
_(outcome_hash.keys).must_include(expected_control)
end
_(run_result.stderr_ignore_deprecations).must_equal "" # TODO: we have a cli_option_json_config triggering somewhere
_(stderr_ignore_deprecations(run_result)).must_equal "" # TODO: we have a cli_option_json_config triggering somewhere
assert_exit_code 100, run_result
end

View file

@ -38,12 +38,12 @@ describe "running profiles with git-based dependencies" do
def assert_relative_fetch_works(profile_name, expected_profiles, expected_controls)
run_result = run_inspec_process("exec #{git_profiles}/#{profile_name}", json: true)
assert_empty run_result.stderr
run_result.must_have_all_controls_passing
assert_json_controls_passing(run_result)
# Should know about the top-level profile and the child profile
assert_equal expected_profiles, (run_result.payload.json["profiles"].map { |p| p["name"] })
assert_equal expected_profiles, (@json["profiles"].map { |p| p["name"] })
controls = run_result.payload.json["profiles"].map { |p| p["controls"] }.flatten.map { |c| c["id"] }.uniq
controls = @json["profiles"].map { |p| p["controls"] }.flatten.map { |c| c["id"] }.uniq
# Should have controls from the top-level and included child profile
expected_controls.each { |control| assert_includes controls, control }
@ -58,7 +58,7 @@ describe "running profiles with git-based dependencies" do
it "should work on a local checkout" do
run_result = run_inspec_process("exec #{git_profiles}/basic-local", json: true)
assert_empty run_result.stderr
run_result.must_have_all_controls_passing
assert_json_controls_passing(run_result)
end
end
# describe "running a profile with a basic remote dependency"

View file

@ -9,63 +9,6 @@ class Module
include Minitest::Spec::DSL
end
module Inspec
class FuncTestRunResult
attr_reader :train_result
attr_reader :payload
extend Forwardable
def_delegator :train_result, :stdout
def_delegator :train_result, :stderr
def_delegator :train_result, :exit_status
def initialize(train_result)
@train_result = train_result
@payload = OpenStruct.new
end
# Intentional failure to cause CI to print output
def diagnose!
msg = ""
msg += "\nInvocation:\n" + payload.invocation
msg += "\nSTDOUT:\n" + stdout
msg += "\nSTDERR:\n" + stderr
msg.must_equal ""
end
def stderr_ignore_deprecations
suffix = stderr.end_with?("\n") ? "\n" : ""
stderr.split("\n").reject { |l| l.include? " DEPRECATION: " }.join("\n") + suffix
end
def stdout_ignore_deprecations
suffix = stdout.end_with?("\n") ? "\n" : ""
stdout.split("\n").reject { |l| l.include? " DEPRECATION: " }.join("\n") + suffix
end
# This works if you use json: true on an exec call
def must_have_all_controls_passing
# Strategy: assemble an array of tests that failed or skipped, and insist it is empty
# result.payload.json['profiles'][0]['controls'][0]['results'][0]['status']
failed_tests = []
payload.json["profiles"].each do |profile_struct|
profile_name = profile_struct["name"]
profile_struct["controls"].each do |control_struct|
control_name = control_struct["id"]
control_struct["results"].compact.each do |test_struct|
test_desc = test_struct["code_desc"]
if test_struct["status"] != "passed"
failed_tests << "#{profile_name}/#{control_name}/#{test_desc}"
end
end
end
end
failed_tests.must_be_empty
end
end
end
module FunctionalHelper
extend Minitest::Spec::DSL
let(:repo_path) do
@ -135,6 +78,32 @@ module FunctionalHelper
FunctionalHelper.is_windows?
end
def stderr_ignore_deprecations(result)
stderr = result.stderr
suffix = stderr.end_with?("\n") ? "\n" : ""
stderr.split("\n").reject { |l| l.include? " DEPRECATION: " }.join("\n") + suffix
end
def assert_json_controls_passing(_result = nil) # dummy arg
# Strategy: assemble an array of tests that failed or skipped, and insist it is empty
# @json['profiles'][0]['controls'][0]['results'][0]['status']
failed_tests = []
@json["profiles"].each do |profile_struct|
profile_name = profile_struct["name"]
profile_struct["controls"].each do |control_struct|
control_name = control_struct["id"]
control_struct["results"].compact.each do |test_struct|
test_desc = test_struct["code_desc"]
if test_struct["status"] != "passed"
failed_tests << "#{profile_name}/#{control_name}/#{test_desc}"
end
end
end
end
_(failed_tests).must_be_empty
end
def inspec(commandline, prefix = nil)
if is_windows?
invocation = "/windows/system32/cmd /C \"#{prefix} #{exec_inspec} #{commandline}\""
@ -144,13 +113,12 @@ module FunctionalHelper
convert_windows_output(result.stdout)
# remove the CLIXML header trash in windows
result.stderr.gsub!("#< CLIXML\n", "")
ftrr = Inspec::FuncTestRunResult.new(result)
else
invocation = "#{prefix} #{exec_inspec} #{commandline}"
ftrr = Inspec::FuncTestRunResult.new(CMD.run_command(invocation))
result = CMD.run_command(invocation)
end
ftrr.payload.invocation = invocation
ftrr
result
end
def inspec_with_env(commandline, env = {})
@ -164,14 +132,13 @@ module FunctionalHelper
# :prefix String A string to prefix to the invocation. Prefix + env + invocation is the order.
# :cwd String A directory to change to. Implemented as 'cd CWD && ' + prefix
# :lock Boolean Default false. If false, add `--no-create-lockfile`.
# :json Boolean Default false. If true, add `--reporter json` and parse the output, which is stored in payload.json .
# :json Boolean Default false. If true, add `--reporter json` and parse the output, which is stored in @json.
# :tmpdir Boolean default true. If true, wrap execution in a Dir.tmpdir block. Use pre_run and post_run to trigger actions.
# :pre_run: Proc(tmp_dir_path) - optional setup block.
# tmp_dir will exist and be empty.
# :post_run: Proc(FuncTestRunResult, tmp_dir_path) - optional result capture block.
# run_result will be populated, but you can add more to the ostruct .payload
# tmp_dir will still exist (for a moment!)
# @return FuncTestRunResult. Includes attrs exit_status, stderr, stdout, payload (an openstruct which may be used in many ways)
# @return Train::Extrans::CommandResult
def run_inspec_process(command_line, opts = {})
raise "Do not use tmpdir and cwd in the same invocation" if opts[:cwd] && opts[:tmpdir]
@ -204,16 +171,14 @@ module FunctionalHelper
if opts[:json] && !run_result.stdout.empty?
begin
payload = JSON.parse(run_result.stdout)
run_result.payload.json = payload
@json = JSON.parse(run_result.stdout)
rescue JSON::ParserError => e
warn "JSON PARSE ERROR: %s" % [e.message]
warn "OUT: <<%s>>" % [run_result.stdout]
warn "ERR: <<%s>>" % [run_result.stderr]
warn "XIT: %p" % [run_result.exit_status]
run_result.payload.json = {}
run_result.payload.json_error = e
@json = {}
@json_error = e
end
end

View file

@ -156,24 +156,24 @@ describe "inputs" do
describe "when the --input is used once with one value" do
let(:input_opt) { "--input test_input_01=value_from_cli_01" }
let(:control_opt) { "--controls test_control_01" }
it("correctly reads the input") { result.must_have_all_controls_passing }
it("correctly reads the input") { assert_json_controls_passing(result) }
end
describe "when the --input is used once with two values" do
let(:input_opt) { "--input test_input_01=value_from_cli_01 test_input_02=value_from_cli_02" }
it("correctly reads the input") { result.must_have_all_controls_passing }
it("correctly reads the input") { assert_json_controls_passing(result) }
end
describe "when the --input is used once with two values and a comma" do
let(:input_opt) { "--input test_input_01=value_from_cli_01, test_input_02=value_from_cli_02" }
it("correctly reads the input") { result.must_have_all_controls_passing }
it("correctly reads the input") { assert_json_controls_passing(result) }
end
describe "when the --input is used twice with one value each" do
let(:input_opt) { "--input test_input_01=value_from_cli_01 --input test_input_02=value_from_cli_02" }
let(:control_opt) { "--controls test_control_02" }
# Expected, though unfortunate, behavior is to only notice the second input
it("correctly reads the input") { result.must_have_all_controls_passing }
it("correctly reads the input") { assert_json_controls_passing(result) }
end
describe "when the --input is used with no equal sign" do
@ -205,14 +205,14 @@ describe "inputs" do
result = run_inspec_process(cmd, json: true)
result.must_have_all_controls_passing
assert_json_controls_passing(result)
end
it "is able to read the inputs using the legacy attribute keyword" do
cmd = "exec #{inputs_profiles_path}/legacy-attributes-dsl"
result = run_inspec_process(cmd, json: true)
result.must_have_all_controls_passing
assert_json_controls_passing(result)
end
end
@ -223,7 +223,7 @@ describe "inputs" do
result = run_inspec_process(cmd, json: true)
result.must_have_all_controls_passing
assert_json_controls_passing(result)
_(result.stderr).must_be_empty
end
@ -232,7 +232,7 @@ describe "inputs" do
result = run_inspec_process(cmd, json: true)
result.must_have_all_controls_passing
assert_json_controls_passing(result)
# Will eventually issue deprecation warning
end
@ -272,7 +272,7 @@ describe "inputs" do
result = run_inspec_process(cmd, json: true)
result.must_have_all_controls_passing
assert_json_controls_passing(result)
end
end
end
@ -285,7 +285,7 @@ describe "inputs" do
_(result.stderr).must_include "WARN: Input 'undeclared_01'"
_(result.stderr).must_include "does not have a value"
result.must_have_all_controls_passing
assert_json_controls_passing(result)
end
end
end

View file

@ -736,7 +736,7 @@ Test Summary: 2 successful, 0 failures, 0 skipped\n"
describe "when specifying a config file" do
let(:run_result) { run_inspec_process("exec " + File.join(profile_path, "simple-metadata") + " " + cli_args, json: true, env: env) }
let(:seen_target_id) { run_result.payload.json["platform"]["target_id"] }
let(:seen_target_id) { @json["platform"]["target_id"] }
let(:stderr) { run_result.stderr }
let(:env) { {} }
@ -769,7 +769,7 @@ Test Summary: 2 successful, 0 failures, 0 skipped\n"
result = run_inspec_process( "exec " + File.join(profile_path, "simple-metadata") + " " + cli_args + " ", opts )
_(result.stderr).must_be_empty
_(result.payload.json["platform"]["target_id"]).must_equal "from-config-file"
_(@json["platform"]["target_id"]).must_equal "from-config-file"
end
it "detect should exit 0" do
@ -842,7 +842,7 @@ Test Summary: 2 successful, 0 failures, 0 skipped\n"
JSON.parse(json).select { |k, v| %w{name release}.include? k }
end
let(:run_result) { run_inspec_process("exec " + File.join(profile_path, "simple-metadata") + " " + cli_args, json: true) }
let(:seen_platform) { run_result.payload.json["platform"].select { |k, v| %w{name release target_id}.include? k } }
let(:seen_platform) { run_result; @json["platform"].select { |k, v| %w{name release target_id}.include? k } }
let(:stderr) { run_result.stderr }
describe "when neither target nor backend is specified" do

View file

@ -11,7 +11,7 @@ describe "Deprecation Facility Behavior" do
let(:run_result) { run_inspec_process(invocation, json: true) }
# Expect one control, 3 results
let(:json_result) { run_result.payload.json["profiles"][0]["controls"][0]["results"] }
let(:json_result) { run_result; @json["profiles"][0]["controls"][0]["results"] }
describe "when the deprecation is in a custom resource and the deprecate DSL method is used" do
describe "when the action is to fail the control" do

View file

@ -111,7 +111,7 @@ describe "input plugins" do
def run_input_plugin_test_with_controls(controls)
cmd = "exec #{profile} --controls #{controls}"
run_result = run_inspec_process(cmd, json: true, env: env)
run_result.must_have_all_controls_passing
assert_json_controls_passing(run_result)
_(run_result.stderr).must_be_empty
end
@ -173,7 +173,6 @@ describe "DSL plugin types support" do
let(:fixture_path) { File.join(profile_path, "dsl_plugins", "controls", profile_file) }
let(:dsl_plugin_path) { File.join(mock_path, "plugins", "inspec-dsl-test", "lib", "inspec-dsl-test.rb") }
let(:run_result) { run_inspec_with_plugin("exec #{fixture_path}", plugin_path: dsl_plugin_path) }
let(:json_result) { run_result.payload.json }
describe "outer profile dsl plugin type support" do
let(:profile_file) { "outer_profile_dsl.rb" }
@ -183,12 +182,12 @@ describe "DSL plugin types support" do
# The outer_profile_dsl.rb file has control-01, then a call to favorite_grain
# (which generates a control), then control-03.
# If the plugin exploded, we'd see control-01 but not control-03
controls = json_result["profiles"][0]["controls"]
controls = @json["profiles"][0]["controls"]
_(controls.count).must_equal 3
# We expect the second controls id to be 'sorghum'
# (this is the functionality of the outer_profile_dsl we installed)
generated_control = json_result["profiles"][0]["controls"][1]
generated_control = @json["profiles"][0]["controls"][1]
_(generated_control["id"]).must_equal "sorghum"
_(generated_control["results"][0]["status"]).must_equal "passed"
end
@ -202,12 +201,12 @@ describe "DSL plugin types support" do
# The control_dsl.rb file has one control, with a describe-01, then a call to favorite_fruit, then describe-02
# If the plugin exploded, we'd see describe-01 but not describe-02
results = json_result["profiles"][0]["controls"][0]["results"]
results = @json["profiles"][0]["controls"][0]["results"]
_(results.count).must_equal 2
# We expect the descriptions to include that the favorite fruit is banana
# (this is the functionality of the control_dsl we installed)
first_description_section = json_result["profiles"][0]["controls"][0]["descriptions"].first
first_description_section = @json["profiles"][0]["controls"][0]["descriptions"].first
_(first_description_section).wont_be_nil
_(first_description_section["label"]).must_equal "favorite_fruit"
_(first_description_section["data"]).must_equal "Banana"
@ -222,12 +221,12 @@ describe "DSL plugin types support" do
# The describe_dsl.rb file has one control, with
# describe-01, describe-02 which contains a call to favorite_vegetable, then describe-03
# If the plugin exploded, we'd see describe-01 but not describe-02
results = json_result["profiles"][0]["controls"][0]["results"]
results = @json["profiles"][0]["controls"][0]["results"]
_(results.count).must_equal 3
# We expect the description of describe-02 to include the word aubergine
# (this is the functionality of the describe_dsl we installed)
second_result = json_result["profiles"][0]["controls"][0]["results"][1]
second_result = @json["profiles"][0]["controls"][0]["results"][1]
_(second_result).wont_be_nil
_(second_result["code_desc"]).must_include "aubergine"
end
@ -241,13 +240,13 @@ describe "DSL plugin types support" do
# The test_dsl.rb file has one control, with
# describe-01, describe-02 which contains a call to favorite_legume, then describe-03
# If the plugin exploded, we'd see describe-01 but not describe-02
results = json_result["profiles"][0]["controls"][0]["results"]
results = @json["profiles"][0]["controls"][0]["results"]
_(results.count).must_equal 3
# I spent a while trying to find a way to get the test to alter its name;
# that won't work for various setup reasons.
# So, it just throws an exception with the word 'edemame' in it.
second_result = json_result["profiles"][0]["controls"][0]["results"][1]
second_result = @json["profiles"][0]["controls"][0]["results"][1]
_(second_result).wont_be_nil
_(second_result["status"]).must_equal "failed"
_(second_result["message"]).must_include "edemame"
@ -268,8 +267,7 @@ describe "DSL plugin types support" do
# We should have three controls; 01 and 03 just do a string match.
# 02 uses the custom resource, which relies on calls to the resource DSL.
# If the plugin exploded, we'd see rdsl-control-01 but not rdsl-control-02
json_result = run_result.payload.json
results = json_result["profiles"][0]["controls"]
results = @json["profiles"][0]["controls"]
_(results.count).must_equal 3
# Control 2 has 2 describes; one uses a simple explicit matcher,

View file

@ -7,7 +7,7 @@ describe "waivers" do
let(:waivers_profiles_path) { "#{profile_path}/waivers" }
let(:run_result) { run_inspec_process(cmd, json: true) }
let(:controls_by_id) { run_result.payload.json.dig("profiles", 0, "controls").map { |c| [c["id"], c] }.to_h }
let(:controls_by_id) { run_result; @json.dig("profiles", 0, "controls").map { |c| [c["id"], c] }.to_h }
let(:cmd) { "exec #{waivers_profiles_path}/#{profile_name} --input-file #{waivers_profiles_path}/#{profile_name}/files/#{waiver_file}" }
def assert_test_outcome(expected, control_id)
@ -92,8 +92,8 @@ describe "waivers" do
let(:profile_name) { "waiver-wrapper" }
let(:waiver_file) { "waivers.yaml" }
it "should set the data in the child but be empty in the wrapper" do
json = run_result.payload.json
child_profile = json["profiles"].detect { |p| p["name"] == "waiver-child" }
run_result
child_profile = @json["profiles"].detect { |p| p["name"] == "waiver-child" }
child_waiver_data = child_profile.dig("controls", 0, "waiver_data")
assert_instance_of Hash, child_waiver_data
refute_empty child_waiver_data
@ -105,7 +105,7 @@ describe "waivers" do
}
assert_equal expected_child_waiver_data, child_waiver_data
wrapper_profile = json["profiles"].detect { |p| p["name"] == "waiver-wrapper" }
wrapper_profile = @json["profiles"].detect { |p| p["name"] == "waiver-wrapper" }
wrapper_waiver_data = wrapper_profile.dig("controls", 0, "waiver_data")
assert_instance_of Hash, wrapper_waiver_data
assert_empty wrapper_waiver_data