Class: Roby::Test::ExpectExecution::Context
- Defined in:
- lib/roby/test/expect_execution.rb
Overview
The context object that allows the expect_execution { }.to { } syntax
Constant Summary collapse
- SETUP_METHODS =
[ :timeout, :wait_until_timeout, :join_all_waiting_work, :scheduler, :garbage_collect, :validate_unexpected_errors, :display_exceptions]
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#expectations ⇒ Object
Returns the value of attribute expectations.
-
#test ⇒ Object
Returns the value of attribute test.
Instance Method Summary collapse
- #method_missing(m, *args) ⇒ Object
- #respond_to_missing?(m, include_private) ⇒ Boolean
-
#to(&expectation_block) ⇒ Object
Declare the expectations and run.
-
#to_run ⇒ Object
Run the block without any expectations.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
55 56 57 58 |
# File 'lib/roby/test/expect_execution.rb', line 55 def method_missing(m, *args) expectations.public_send(m, *args) self end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block
41 42 43 |
# File 'lib/roby/test/expect_execution.rb', line 41 def block @block end |
#expectations ⇒ Object
Returns the value of attribute expectations
41 42 43 |
# File 'lib/roby/test/expect_execution.rb', line 41 def expectations @expectations end |
#test ⇒ Object
Returns the value of attribute test
41 42 43 |
# File 'lib/roby/test/expect_execution.rb', line 41 def test @test end |
Instance Method Details
#respond_to_missing?(m, include_private) ⇒ Boolean
51 52 53 |
# File 'lib/roby/test/expect_execution.rb', line 51 def respond_to_missing?(m, include_private) SETUP_METHODS.include?(m) end |
#to(&expectation_block) ⇒ Object
Declare the expectations and run
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/roby/test/expect_execution.rb', line 69 def to(&expectation_block) test.setup_current_expect_execution(self) if expectation_block expectations.parse(&expectation_block) end expectations.verify(&block) rescue Minitest::Assertion => e raise e, e., caller(2) ensure test.reset_current_expect_execution end |
#to_run ⇒ Object
Run the block without any expectations
Expectations might be added dynamically by the block given to expect_execution using Roby::Test::ExpectExecution#add_expectations
64 65 66 |
# File 'lib/roby/test/expect_execution.rb', line 64 def to_run to end |