Sha256: 9fd238e690dbeb85b348b4e8300e9e40c4ad2f6ae5b1115d287f2acd302abf71

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

## ruby -Itest -Ilib test/missing_event_ex_test.rb
require 'test_helper'

#
# test bad data and exceptions
#
                            
class LightGreenState  < StateObjects::Base
  state_object_values :green, 'G', 'Walk' 
end        

class MissingEventExModelUnderTest < SuperModel::Base
  extend StateObjects::ModelAdditions
  state_objects :color_state,
     LightGreenState

  begin 
    state_object_events :color_state, :missing_event
                                                                                   
  rescue StateObjects::Error => ex
    @@exception_missing_event = ex
  end

  def self.exception_missing_event
    @@exception_missing_event
  end

end

class MissingEventExTest < Test::Unit::TestCase
  def setup
    @model  = MissingEventExModelUnderTest
  end

  def test_exception_missing_event
    assert_equal StateObjects::Error, MissingEventExModelUnderTest.exception_missing_event.class
    assert_equal "Invalid state class LightGreenState must implement #missing_event",
                  MissingEventExModelUnderTest.exception_missing_event.message
  end 

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
state_objects-0.9.2 test/missing_event_ex_test.rb