Sha256: 5adaf0a6e9f9d31667455404cd2f03b90ac7c04f2bf5f201fffd619c06f6097f
Contents?: true
Size: 920 Bytes
Versions: 2
Compression:
Stored size: 920 Bytes
Contents
require File.join(File.dirname(__FILE__), *%w[.. test_helper]) class TransitionTest < Test::Unit::TestCase context "Calling #next_state_for" do setup do @mum = Object.new @mum.class.instance_eval do include Apotomo::Transition end end should "return nil when no transition is defined" do assert_not @mum.send(:next_state_for, :snuggle) end should "return the defined next state" do @mum.class.instance_eval do transition :from => :snuggle, :to => :sleep end assert_equal :sleep, @mum.send(:next_state_for, :snuggle) end should "return the state that was defined last" do @mum.class.instance_eval do transition :from => :snuggle, :to => :sleep transition :from => :snuggle, :to => :snore end assert_equal :snore, @mum.send(:next_state_for, :snuggle) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
apotomo-0.1.2 | test/unit/transition_test.rb |
apotomo-0.1.1 | test/unit/transition_test.rb |