Sha256: c3efe594ac90204ba32122e0d02e41cf5fa3b44a944171359cba7b093efa9f64

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require File.dirname(__FILE__) + '/../../../../../../spec_helper'
include OpenEHR::AM::Archetype::ConstraintModel::Primitive
include OpenEHR::RM::DataTypes::Text

describe CPrimitive do
  before(:each) do
    default = DvText.new(:value => 'DEFAULT')
    assumed = DvText.new(:value => 'ASSUMED')
    @c_primitive = CPrimitive.new(:default_value => default,
                                  :assumed_value => assumed)
  end

  it 'should be an instance of CPrimitive' do
    @c_primitive.should be_an_instance_of CPrimitive
  end

  it 'default value should be assigned properly' do
    @c_primitive.default_value.value.should == 'DEFAULT'
  end

  it 'should raise ArgumentError when default_value is nil' do
    lambda {
      @c_primitive.default_value = nil
    }.should raise_error ArgumentError
  end

  it 'assumed_value should be assigned properly' do
    @c_primitive.assumed_value.value.should == 'ASSUMED'
  end

  it 'should be true when assumed_value is assigned' do
    @c_primitive.should have_assumed_value
  end

  it 'should not be true when assumed_value is not assigned' do
    @c_primitive.assumed_value = nil
    @c_primitive.should_not have_assumed_value
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
open_ehr-0.6.1 spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_primitive_spec.rb