Class: BlockingMatcher
- Defined in:
- lib/extensions/mspec/mspec/matchers/block_caller.rb
Instance Method Summary collapse
Instance Method Details
#failure_message ⇒ Object
22 23 24 |
# File 'lib/extensions/mspec/mspec/matchers/block_caller.rb', line 22 def ['Expected the given Proc', 'to block the caller'] end |
#matches?(block) ⇒ Boolean
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/extensions/mspec/mspec/matchers/block_caller.rb', line 2 def matches?(block) started = false blocking = true thread = Thread.new do started = true block.call blocking = false end while !started and status = thread.status and status != "sleep" Thread.pass end thread.kill thread.join blocking end |
#negative_failure_message ⇒ Object
26 27 28 |
# File 'lib/extensions/mspec/mspec/matchers/block_caller.rb', line 26 def ['Expected the given Proc', 'to not block the caller'] end |