/vendor/plugins/state_machine/test/unit/state_machine_test.rb
Ruby | 31 lines | 25 code | 6 blank | 0 comment | 0 complexity | 397b6bf1d7bf878a36de7380b8a7e127 MD5 | raw file
Possible License(s): JSON, MIT
- require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
- class StateMachineByDefaultTest < Test::Unit::TestCase
- def setup
- @klass = Class.new
- @machine = @klass.state_machine
- end
-
- def test_should_use_state_attribute
- assert_equal :state, @machine.attribute
- end
- end
- class StateMachineTest < Test::Unit::TestCase
- def setup
- @klass = Class.new
- end
-
- def test_should_allow_state_machines_on_any_class
- assert @klass.respond_to?(:state_machine)
- end
-
- def test_should_evaluate_block_within_machine_context
- responded = false
- @klass.state_machine(:state) do
- responded = respond_to?(:event)
- end
-
- assert responded
- end
- end