Class: Inspec::OrTest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tests) ⇒ OrTest

Returns a new instance of OrTest.



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

def initialize(tests)
  @tests = tests
end

Instance Attribute Details

#testsObject (readonly)

Returns the value of attribute tests.



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

def tests
  @tests
end

Instance Method Details

#skipObject



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

def skip
  nil
end

#to_hashObject



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

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

#to_rubyObject



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

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