Line | |
---|
1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | include OpenEHR::AM::Archetype::Ontology
|
---|
3 |
|
---|
4 | describe ArchetypeTerm do
|
---|
5 | before(:each) do
|
---|
6 | items = {'TEXT' => 'text', 'DESC' => 'description'}
|
---|
7 | @archetype_term = ArchetypeTerm.new(:code => 'at0001',
|
---|
8 | :items => items)
|
---|
9 | end
|
---|
10 |
|
---|
11 | it 'should be an instance of ArchetypeTerm' do
|
---|
12 | @archetype_term.should be_an_instance_of ArchetypeTerm
|
---|
13 | end
|
---|
14 |
|
---|
15 | it 'code should be assigned properly' do
|
---|
16 | @archetype_term.code.should == 'at0001'
|
---|
17 | end
|
---|
18 |
|
---|
19 | it 'should raise ArgumentError if code is nil' do
|
---|
20 | lambda {
|
---|
21 | @archetype_term.code = nil
|
---|
22 | }.should raise_error ArgumentError
|
---|
23 | end
|
---|
24 |
|
---|
25 | it 'should raise ArgumentError if code is empty' do
|
---|
26 | lambda {
|
---|
27 | @archetype_term.code = ''
|
---|
28 | }.should raise_error ArgumentError
|
---|
29 | end
|
---|
30 |
|
---|
31 | it 'items should be assigned properly' do
|
---|
32 | @archetype_term.items['TEXT'].should == 'text'
|
---|
33 | end
|
---|
34 |
|
---|
35 | it 'keys should be a set of keys of item' do
|
---|
36 | @archetype_term.keys.should == Set['TEXT', 'DESC']
|
---|
37 | end
|
---|
38 |
|
---|
39 | it 'keys should be empty if items are nil' do
|
---|
40 | @archetype_term.items = nil
|
---|
41 | @archetype_term.keys.should == Set.new
|
---|
42 | end
|
---|
43 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.