Class: StateMachinesRspec::Matchers::Events::Matcher
- Inherits:
-
Object
- Object
- StateMachinesRspec::Matchers::Events::Matcher
show all
- Defined in:
- lib/matchers/events/matcher.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(events) ⇒ Matcher
Returns a new instance of Matcher.
9
10
11
12
|
# File 'lib/matchers/events/matcher.rb', line 9
def initialize(events)
@options = events.
@events = events
end
|
Instance Attribute Details
#failure_message ⇒ Object
Returns the value of attribute failure_message.
7
8
9
|
# File 'lib/matchers/events/matcher.rb', line 7
def failure_message
@failure_message
end
|
Instance Method Details
#description ⇒ Object
29
30
31
32
33
|
# File 'lib/matchers/events/matcher.rb', line 29
def description
message = @events.map{ |event| event.inspect }.join(', ')
message << " when #{state_name.inspect}" if state_name
message
end
|
#matches?(subject) ⇒ Boolean
14
15
16
17
18
19
20
21
22
|
# File 'lib/matchers/events/matcher.rb', line 14
def matches?(subject)
@subject = subject
@introspector = StateMachinesIntrospector.new(@subject,
@options.fetch(:on, nil))
enter_when_state
return false if undefined_events?
return false unless matches_events?(@events)
@failure_message.nil?
end
|
#matches_events?(events) ⇒ Boolean
24
25
26
27
|
# File 'lib/matchers/events/matcher.rb', line 24
def matches_events?(events)
raise NotImplementedError,
"subclasses of #{self.class} must override matches_events?"
end
|