Sha256: 5d4fc00d2dcacf28d1bf46aadb9a089bc2a8c2998d0bfded72ebfb7d4bbc5f55

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

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

describe ArchetypeTerm do
  before(:each) do
    items = {'text' => 'text', 'description' => 'description'}
    @archetype_term = ArchetypeTerm.new(:code => 'at0001',
                                        :items => items)
  end

  it 'should be an instance of ArchetypeTerm' do
    @archetype_term.should be_an_instance_of ArchetypeTerm
  end

  it 'code should be assigned properly' do
    @archetype_term.code.should == 'at0001'
  end

  it 'should raise ArgumentError if code is nil' do
    lambda {
      @archetype_term.code = nil
    }.should raise_error ArgumentError
  end

  it 'should raise ArgumentError if code is empty' do
    lambda {
      @archetype_term.code = ''
    }.should raise_error ArgumentError
  end

  it 'items should be assigned properly' do
    @archetype_term.items['text'].should == 'text'
  end

  it 'keys should be a set of keys of item' do
    @archetype_term.keys.should == Set['text', 'description']
  end

  it 'keys should be empty if items are nil' do
    @archetype_term.items = nil
    @archetype_term.keys.should == Set.new
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openehr-1.2.8 spec/lib/openehr/am/archetype/ontology/archetype_term_spec.rb
openehr-1.2.7 spec/lib/openehr/am/archetype/ontology/archetype_term_spec.rb
openehr-1.2.6 spec/lib/openehr/am/archetype/ontology/archetype_term_spec.rb
openehr-1.2.5 spec/lib/openehr/am/archetype/ontology/archetype_term_spec.rb
openehr-1.2.4 spec/lib/openehr/am/archetype/ontology/archetype_term_spec.rb
openehr-1.2.3 spec/lib/openehr/am/archetype/ontology/archetype_term_spec.rb
openehr-1.2.2 spec/lib/openehr/am/archetype/ontology/archetype_term_spec.rb