class MachineClassDrawingTest
Public Class Methods
name()
click to toggle source
# File test/unit/machine_test.rb, line 3273 def self.name; 'Vehicle'; end
Public Instance Methods
setup()
click to toggle source
# File test/unit/machine_test.rb, line 3271 def setup @klass = Class.new do def self.name; 'Vehicle'; end end @machine = StateMachine::Machine.new(@klass) @machine.event :ignite do transition :parked => :idling end end
test_should_allow_path_and_format_to_be_customized()
click to toggle source
# File test/unit/machine_test.rb, line 3293 def test_should_allow_path_and_format_to_be_customized StateMachine::Machine.draw('Switch', :file => File.expand_path("#{File.dirname(__FILE__)}/../files/switch.rb"), :path => "#{File.dirname(__FILE__)}/", :format => 'jpg') assert File.exist?("#{File.dirname(__FILE__)}/Switch_state.jpg") ensure FileUtils.rm("#{File.dirname(__FILE__)}/Switch_state.jpg") end
test_should_load_files()
click to toggle source
# File test/unit/machine_test.rb, line 3286 def test_should_load_files StateMachine::Machine.draw('Switch', :file => File.expand_path("#{File.dirname(__FILE__)}/../files/switch.rb")) assert defined?(::Switch) ensure FileUtils.rm('./Switch_state.png') end
test_should_raise_exception_if_no_class_names_specified()
click to toggle source
# File test/unit/machine_test.rb, line 3281 def test_should_raise_exception_if_no_class_names_specified exception = assert_raise(ArgumentError) {StateMachine::Machine.draw(nil)} assert_equal 'At least one class must be specified', exception.message end