Sha256: dfde20d2c0abd55227c5c2e9bc12d7d23064912ff573d3fa2559984aad6f4e32
Contents?: true
Size: 956 Bytes
Versions: 6
Compression:
Stored size: 956 Bytes
Contents
require 'matchers/events/matcher' module StateMachinesRspec module Matchers def reject_events(value, *values) RejectEventMatcher.new(values.unshift(value)) end alias_method :reject_event, :reject_events class RejectEventMatcher < StateMachinesRspec::Matchers::Events::Matcher def matches_events?(events) !valid_events? end def description message = super message << " on #{state_machine_scope.inspect}" if state_machine_scope "reject #{message}" end private def valid_events? valid_events = @introspector.valid_events(@events) unless valid_events.empty? @failure_message = "Did not expect to be able to handle events: " + "#{valid_events.join(', ')} in state: " + "#{@introspector.current_state_value}" end !valid_events.empty? end end end end
Version data entries
6 entries across 6 versions & 2 rubygems