Sha256: 8fcdc2e0b590a66f5a80894b90817fc0144975701cd2180e8efa1b12f4db71e9
Contents?: true
Size: 922 Bytes
Versions: 6
Compression:
Stored size: 922 Bytes
Contents
require 'matchers/states/matcher' module StateMachinesRspec module Matchers def reject_states(state, *states) RejectStateMatcher.new(states.unshift(state)) end alias_method :reject_state, :reject_states class RejectStateMatcher < StateMachinesRspec::Matchers::States::Matcher def matches_states?(states) no_defined_states? end def description message = super message << " on #{state_machine_scope.inspect}" if state_machine_scope "not have #{message}" end private def no_defined_states? defined_states = @introspector.defined_states(@states) unless defined_states.empty? @failure_message = "Did not expect #{@introspector.state_machine_attribute} " + "to allow states: #{defined_states.join(', ')}" end defined_states.empty? end end end end
Version data entries
6 entries across 6 versions & 2 rubygems