Class: Inspec::Test
- Inherits:
-
Object
- Object
- Inspec::Test
- Includes:
- RubyHelper
- Defined in:
- lib/inspec/objects/test.rb
Instance Attribute Summary collapse
-
#expectation ⇒ Object
Returns the value of attribute expectation.
-
#matcher ⇒ Object
Returns the value of attribute matcher.
-
#negated ⇒ Object
Returns the value of attribute negated.
-
#only_if ⇒ Object
Returns the value of attribute only_if.
-
#qualifier ⇒ Object
Returns the value of attribute qualifier.
-
#skip ⇒ Object
Returns the value of attribute skip.
-
#variables ⇒ Object
Returns the value of attribute variables.
Instance Method Summary collapse
-
#initialize ⇒ Test
constructor
A new instance of Test.
- #negate! ⇒ Object
- #remove_expectation ⇒ Object
- #resource ⇒ Object
- #to_hash ⇒ Object
- #to_ruby ⇒ Object
Methods included from RubyHelper
Constructor Details
#initialize ⇒ Test
Returns a new instance of Test.
11 12 13 14 15 16 17 |
# File 'lib/inspec/objects/test.rb', line 11 def initialize @qualifier = [] @negated = false @variables = [] Inspec.deprecate(:object_classes, "The Inspec::Test class is deprecated. Use the Inspec::Object::Test class from the inspec-objects Ruby library.") end |
Instance Attribute Details
#expectation ⇒ Object
Returns the value of attribute expectation.
8 9 10 |
# File 'lib/inspec/objects/test.rb', line 8 def expectation @expectation end |
#matcher ⇒ Object
Returns the value of attribute matcher.
8 9 10 |
# File 'lib/inspec/objects/test.rb', line 8 def matcher @matcher end |
#negated ⇒ Object
Returns the value of attribute negated.
8 9 10 |
# File 'lib/inspec/objects/test.rb', line 8 def negated @negated end |
#only_if ⇒ Object
Returns the value of attribute only_if.
8 9 10 |
# File 'lib/inspec/objects/test.rb', line 8 def only_if @only_if end |
#qualifier ⇒ Object
Returns the value of attribute qualifier.
8 9 10 |
# File 'lib/inspec/objects/test.rb', line 8 def qualifier @qualifier end |
#skip ⇒ Object
Returns the value of attribute skip.
8 9 10 |
# File 'lib/inspec/objects/test.rb', line 8 def skip @skip end |
#variables ⇒ Object
Returns the value of attribute variables.
8 9 10 |
# File 'lib/inspec/objects/test.rb', line 8 def variables @variables end |
Instance Method Details
#negate! ⇒ Object
19 20 21 |
# File 'lib/inspec/objects/test.rb', line 19 def negate! @negated = !@negated end |
#remove_expectation ⇒ Object
42 43 44 |
# File 'lib/inspec/objects/test.rb', line 42 def remove_expectation remove_instance_variable(:@expectation) end |
#resource ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/inspec/objects/test.rb', line 33 def resource @resource ||= if qualifier.empty? || qualifier[0].empty? || qualifier[0][0].empty? nil else qualifier[0][0] end end |
#to_hash ⇒ Object
29 30 31 |
# File 'lib/inspec/objects/test.rb', line 29 def to_hash { qualifier: qualifier, matcher: matcher, expectation: expectation, skip: skip, negated: negated } end |
#to_ruby ⇒ Object
23 24 25 26 27 |
# File 'lib/inspec/objects/test.rb', line 23 def to_ruby return rb_skip unless skip.nil? rb_describe end |