Sha256: 34c876b48607b9fc7d5b23da3a74cdeb7057cf66ed5ff1ef6882fc9641fcdb41
Contents?: true
Size: 1.65 KB
Versions: 3
Compression:
Stored size: 1.65 KB
Contents
require 'helper' class TestChevy < Test::Unit::TestCase class Engine attr :state def initialize @state = "off" end rules do rule(/is_(.*)/) do |state| @state = state.gsub(/_/, " ") end end end context 'A Chevy engine checked with #state_is?' do setup do @chevy = Engine.new class << @chevy def state_is?(state) @state == state end end end should 'be off' do assert @chevy.state_is?('off') end should 'be idling' do @chevy.is_idling assert @chevy.state_is?('idling') end should 'be broken as usual' do @chevy.is_broken_as_usual assert @chevy.state_is?('broken as usual') end end context 'A Chevy engine checked with custom rule' do setup do @chevy = Engine.new class << @chevy rules do rule(/is_(.*)?/) do |state| @state == state end end end end should 'be off' do assert @chevy.is_off? end should 'be idling' do @chevy.is_idling assert @chevy.is_idling? end should 'be broken as usual' do @chevy.is_broken_as_usual assert @chevy.is_broken_as_usual? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rulebook-0.3.0 | test/test_chevy.rb |
rulebook-0.2.1 | test/test_chevy.rb |
rulebook-0.2.0 | test/test_chevy.rb |