Class: Auger::Test
- Inherits:
-
Object
- Object
- Auger::Test
- Defined in:
- lib/auger/test.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, block) ⇒ Test
constructor
A new instance of Test.
-
#run(response) ⇒ Object
return Auger::Result object with outcome of test.
Constructor Details
#initialize(name, block) ⇒ Test
Returns a new instance of Test.
6 7 8 9 |
# File 'lib/auger/test.rb', line 6 def initialize(name, block) @name = name @block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
4 5 6 |
# File 'lib/auger/test.rb', line 4 def block @block end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/auger/test.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/auger/test.rb', line 4 def name @name end |
Instance Method Details
#run(response) ⇒ Object
return Auger::Result object with outcome of test
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/auger/test.rb', line 12 def run(response) outcome = if response.is_a?(Exception) or @block.nil? response else @block.call(response) rescue $! # run the test end result = outcome.is_a?(Result) ? outcome : Auger::Result.new(outcome) result.test = self result end |