Class: GUnit::Verification
- Inherits:
-
Object
- Object
- GUnit::Verification
- Defined in:
- lib/gunit/verification.rb
Instance Attribute Summary collapse
- #message ⇒ Object
-
#task ⇒ Object
Returns the value of attribute task.
Instance Method Summary collapse
- #default_message ⇒ Object
-
#initialize(*args, &blk) ⇒ Verification
constructor
Verification.new(“my message”) Verification.new(“my message”) { assert true } Verification.new() { assert true }.
- #run(binding = self) ⇒ Object
Constructor Details
#initialize(*args, &blk) ⇒ Verification
Verification.new(“my message”) Verification.new(“my message”) { assert true } Verification.new() { assert true }
10 11 12 13 |
# File 'lib/gunit/verification.rb', line 10 def initialize(*args, &blk) self. = args[0] self.task = blk if blk end |
Instance Attribute Details
#message ⇒ Object
31 32 33 |
# File 'lib/gunit/verification.rb', line 31 def @message || end |
#task ⇒ Object
Returns the value of attribute task.
5 6 7 |
# File 'lib/gunit/verification.rb', line 5 def task @task end |
Instance Method Details
#default_message ⇒ Object
35 36 37 |
# File 'lib/gunit/verification.rb', line 35 def "Verification failed!" end |
#run(binding = self) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gunit/verification.rb', line 15 def run(binding=self) begin if @task.is_a?(Proc) bound_task = @task.bind(binding) bound_task.call PassResponse.new else ToDoResponse.new(self., Kernel.caller) end rescue GUnit::AssertionFailure => e FailResponse.new(e., e.backtrace) rescue ::Exception => e ExceptionResponse.new(e., e.backtrace) end end |