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

Last change on this file since 229 was 229, checked in by KOBAYASHI, Shinji, 15 years ago

move from test to rspec

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