source: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/term_mapping_spec.rb @ 228

Last change on this file since 228 was 228, checked in by KOBAYASHI, Shinji, 11 years ago

Terminology implementation is a little difficult

File size: 1.5 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::DataTypes::Text
3include OpenEHR::RM::Support::Identification
4
5describe TermMapping do
6  before(:each) do
7    target_stub = stub(DvCodedText, :value => 'TEST')
8    purpose_stub = stub(DvCodedText, :value => 'automated')
9    @term_mapping = TermMapping.new(:target => target_stub,
10                                    :match => '=',
11                                    :purpose => purpose_stub)
12  end
13
14  it 'should means equivalent' do
15    @term_mapping.should be_equivalent
16  end
17
18  it 'should means narrower' do
19    @term_mapping.match = '<'
20    @term_mapping.should be_narrower
21  end
22
23  it 'should means broader' do
24    @term_mapping.match = '>'
25    @term_mapping.should be_broader
26  end
27
28  it 'should means unknown' do
29    @term_mapping.match = '?'
30    @term_mapping.should be_unknown
31  end
32
33  it 'should be valid match code >' do
34    TermMapping.is_valid_mach_code?('>').should be_true
35  end
36
37  it 'should be valid match code =' do
38    TermMapping.is_valid_mach_code?('=').should be_true
39  end
40
41  it 'should be valid match code <' do
42    TermMapping.is_valid_mach_code?('<').should be_true
43  end
44
45  it 'should be valid match code ?' do
46    TermMapping.is_valid_mach_code?('?').should be_true
47  end
48
49  it 'should be not valid code /' do
50    TermMapping.is_valid_mach_code?('/').should_not be_true
51  end
52
53  it 's purpose should == automated' do
54    @term_mapping.purpose.value.should == 'automated'
55  end
56end
Note: See TracBrowser for help on using the repository browser.