Sha256: e467d9b60b4a81c60b74022eb8c7ff6326a4b823a910b016611833bb4a37abb3
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
require 'helper' class TestChevy < Test::Unit::TestCase class Engine attr_accessor :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.3 | test/test_chevy.rb |
rulebook-0.3.2 | test/test_chevy.rb |
rulebook-0.3.1 | test/test_chevy.rb |