Method: Inspec::Object::OrTest#to_ruby
- Defined in:
- lib/inspec/objects/or_test.rb
#to_ruby ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/inspec/objects/or_test.rb', line 17 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 all_tests = @tests.map do |test| test.negate! test end.map(&:to_ruby).join("\n") all_tests else all_tests = @tests.map(&:to_ruby).join("\n").gsub("\n", "\n ") format("describe.one do\n %s\nend", all_tests) end end |