Sha256: fcb9b2a8bbd7d31d0e971be872a510709caa18f4dc4feff07848bd51a305c770

Contents?: true

Size: 1.58 KB

Versions: 26

Compression:

Stored size: 1.58 KB

Contents

require File.dirname(__FILE__) + '/../../../../../spec_helper'
include OpenEHR::AM::Archetype::ConstraintModel
include OpenEHR::AssumedLibraryTypes

describe CDefinedObject do
  before(:each) do
    occurrences = Interval.new(:lower => 0, :upper => 1)
    parent = stub(CAttribute, :rm_attribute_name => 'DV_DATE')
    @c_defined_object = CDefinedObject.new(:path => '/event/[at0001]/',
                                           :rm_type_name => 'DV_TIME',
                                           :node_id => 'ac0001',
                                           :occurrences => occurrences,
                                           :assumed_value => 'ANY')
  end

  it 'should be an instance of CDefinedObject' do
    @c_defined_object.should be_an_instance_of CDefinedObject
  end

  it 'should be assigned properly' do
    @c_defined_object.assumed_value.should == 'ANY'
  end

  it 'has_assumed_value should be true' do
    @c_defined_object.should have_assumed_value
  end

  it 'has_assumed_value should not be true' do
    @c_defined_object.assumed_value = nil
    @c_defined_object.should_not have_assumed_value
  end

  it 'default_value should raise NotImplementedError' do
    lambda {
      @c_defined_object.default_value
    }.should raise_error NotImplementedError
  end

  it 'valid_value should raise NotImplementedError' do
    lambda {
      @c_defined_object.valid_value?(1)
    }.should raise_error NotImplementedError
  end

  it 'any_allowed should raise NotImplementedError' do
    lambda {
      @c_defined_object.any_allowed?
    }.should raise_error NotImplementedError
  end
end



Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
open_ehr-0.9.4 spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb
open_ehr-0.9.3 spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb
open_ehr-0.9.2 spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb
open_ehr-0.9.1 spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb
open_ehr-0.9.0 spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb
open_ehr-0.6.1 spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb