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