Failing tests for #4799

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2020-05-05 18:09:11 -04:00
parent 970f583764
commit 786e3728d7
2 changed files with 37 additions and 0 deletions

View file

@ -70,3 +70,21 @@ control "test_control_json_deep" do
it { should eq expected }
end
end
control "test_control_bool_true" do
describe input("test_input_13", value: "value_from_dsl") do
it { should be_a TrueClass }
end
end
control "test_control_bool_false" do
describe input("test_input_14", value: "value_from_dsl") do
it { should be_a FalseClass }
end
end
control "test_control_bool_string" do
describe input("test_input_15", value: "value_from_dsl") do
it { should eq "TRUE" }
end
end

View file

@ -187,6 +187,25 @@ describe "inputs" do
end
end
# See https://github.com/inspec/inspec/issues/4799
describe "when the --input is used with a boolean value" do
describe "when the --input is passed true" do
let(:input_opt) { "--input test_input_13=true" }
let(:control_opt) { "--controls test_control_bool_true" }
it("correctly reads the input as TrueClass") { assert_json_controls_passing(result) }
end
describe "when the --input is passed false" do
let(:input_opt) { "--input test_input_14=false" }
let(:control_opt) { "--controls test_control_bool_false" }
it("correctly reads the input as FalseClass") { assert_json_controls_passing(result) }
end
describe "when the --input is passed TRUE" do
let(:input_opt) { "--input test_input_15=TRUE" }
let(:control_opt) { "--controls test_control_bool_string" }
it("correctly reads the input as a string") { assert_json_controls_passing(result) }
end
end
describe "when the --input is a complex structure" do
# Garbage