Class: Wisper::RSpec::BroadcastMatcher::Matcher
- Inherits:
-
Object
- Object
- Wisper::RSpec::BroadcastMatcher::Matcher
- Defined in:
- lib/wisper/rspec/matchers.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(event) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(block) ⇒ Boolean
- #supports_block_expectations? ⇒ Boolean
Constructor Details
#initialize(event) ⇒ Matcher
Returns a new instance of Matcher.
25 26 27 |
# File 'lib/wisper/rspec/matchers.rb', line 25 def initialize(event) @event = event end |
Instance Method Details
#failure_message ⇒ Object
43 44 45 |
# File 'lib/wisper/rspec/matchers.rb', line 43 def "expected publisher to broadcast #{@event} event" end |
#failure_message_when_negated ⇒ Object
47 48 49 |
# File 'lib/wisper/rspec/matchers.rb', line 47 def "expected publisher not to broadcast #{@event} event" end |
#matches?(block) ⇒ Boolean
33 34 35 36 37 38 39 40 41 |
# File 'lib/wisper/rspec/matchers.rb', line 33 def matches?(block) event_recorder = EventRecorder.new Wisper.subscribe(event_recorder) do block.call end event_recorder.broadcast?(@event) end |
#supports_block_expectations? ⇒ Boolean
29 30 31 |
# File 'lib/wisper/rspec/matchers.rb', line 29 def supports_block_expectations? true end |