test/test_chevy.rb in rulebook-0.1.1 vs test/test_chevy.rb in rulebook-0.2.0
- old
+ new
@@ -1,18 +1,19 @@
require 'helper'
class TestChevy < Test::Unit::TestCase
class Engine
- follows_rules
attr :state
def initialize
@state = "off"
end
- rule(/is_(.*)/) do |state|
- @state = state.gsub(/_/, " ")
+ rules do
+ rule(/is_(.*)/) do |state|
+ @state = state.gsub(/_/, " ")
+ end
end
end
context 'A Chevy engine checked with #state_is?' do
setup do
@@ -41,11 +42,13 @@
context 'A Chevy engine checked with custom rule' do
setup do
@chevy = Engine.new
class << @chevy
- rule(/is_(.*)?/) do |state|
- @state == state
+ rules do
+ rule(/is_(.*)?/) do |state|
+ @state == state
+ end
end
end
end
should 'be off' do
\ No newline at end of file