Sha256: ba30b207542007ef1352dc10e6ebeaf28d3aa2f19273490ff742904f198932ea

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

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

#
# test bad data and exceptions
#
       
class NoStateObjectValues < StateObjects::Base
end

class ModelUnderTest < SuperModel::Base
  extend StateObjects::ModelAdditions
    
  begin                                             
    state_objects :no_state,
       NoStateObjectValues    
  rescue RuntimeError => ex
    @@ex_no_state_values = ex
  end

  def self.ex_no_state_values
    @@ex_no_state_values
  end

end

class StateObjectValuesTest < Test::Unit::TestCase
  def setup
    @model  = ModelUnderTest
  end

  def test_no_state_values
    assert_equal RuntimeError, ModelUnderTest.ex_no_state_values.class
    assert_equal "Invalid State class [NoStateObjectValues]. Must implement a class method named: #symbol.  Use #state_object_values to setup StateObject",
                  ModelUnderTest.ex_no_state_values.message
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
state_objects-0.9.1 test/state_object_values_test.rb
state_objects-0.9.0 test/state_object_values_test.rb
state_objects-0.0.8 test/state_object_values_test.rb