Permalink
Browse files

Use a whitelist matcher for success requirements in guards to be more…

… explicit with the expected values
  • Loading branch information...
1 parent 4efa075 commit bfe51c183f93975c5ce207425fa4c38a753d77fa @obrie obrie committed Aug 15, 2009
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/state_machine/guard.rb
  2. +1 −1 test/unit/guard_test.rb
View
2 lib/state_machine/guard.rb
@@ -43,7 +43,7 @@ def initialize(options = {}) #:nodoc:
@event_requirement = build_matcher(options, :on, :except_on)
# Build success requirement
- @success_requirement = options.delete(:include_failures) ? AllMatcher.instance : BlacklistMatcher.new([false])
+ @success_requirement = options.delete(:include_failures) ? AllMatcher.instance : WhitelistMatcher.new([true])
if (options.keys - [:from, :to, :on, :except_from, :except_to, :except_on]).empty?
# Explicit from/to requirements specified
View
2 test/unit/guard_test.rb
@@ -411,7 +411,7 @@ def setup
end
def test_should_use_a_blacklist_matcher
- assert_instance_of StateMachine::BlacklistMatcher, @guard.success_requirement
+ assert_instance_of StateMachine::WhitelistMatcher, @guard.success_requirement
end
def test_should_match_if_not_specified

0 comments on commit bfe51c1

Please sign in to comment.