class Inspec::Object::OrTest
Attributes
tests[R]
Public Class Methods
new(tests)
click to toggle source
# File lib/inspec/objects/or_test.rb, line 6 def initialize(tests) @tests = tests @negated = false end
Public Instance Methods
negate!()
click to toggle source
# File lib/inspec/objects/or_test.rb, line 15 def negate! @negated = !@negated end
skip()
click to toggle source
# File lib/inspec/objects/or_test.rb, line 11 def skip nil end
to_hash()
click to toggle source
# File lib/inspec/objects/or_test.rb, line 35 def to_hash { describe_one: @tests.map(&:to_hash) } end
to_ruby()
click to toggle source
# File lib/inspec/objects/or_test.rb, line 19 def to_ruby if @negated # We don't use the describe.one wrapper when negated because: # !(test1 || test2) same as (!test1 && !test2) where && is implicit in inspec @tests.map do |test| test.negate! test end.map(&:to_ruby).join("\n") else all_tests = @tests.map(&:to_ruby).join("\n").gsub("\n", "\n ") format("describe.one do\n %s\nend", all_tests) end end