Class: Inspec::OrTest

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/objects/or_test.rb

Instance Method Summary collapse

Constructor Details

#initialize(tests) ⇒ OrTest

Returns a new instance of OrTest.



5
6
7
# File 'lib/inspec/objects/or_test.rb', line 5

def initialize(tests)
  @tests = tests
end

Instance Method Details

#skipObject



9
10
11
# File 'lib/inspec/objects/or_test.rb', line 9

def skip
  nil
end

#to_hashObject



18
19
20
# File 'lib/inspec/objects/or_test.rb', line 18

def to_hash
  { describe_one: @tests.map(&:to_hash) }
end

#to_rubyObject



13
14
15
16
# File 'lib/inspec/objects/or_test.rb', line 13

def to_ruby
  all_tests = @tests.map(&:to_ruby).join("\n").gsub("\n", "\n  ")
  format("describe.one do\n  %s\nend", all_tests)
end