source: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/encapsulated/dv_encapsulated_spec.rb @ 239

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

add encapsulated spec

File size: 1.3 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::DataTypes::Encapsulated
3include OpenEHR::RM::DataTypes::Text
4
5describe DvEncapsulated do
6  before(:each) do
7    dummy = 'test'
8    charset = stub(CodePhrase, :code_string => 'UTF-8')
9    language = stub(CodePhrase, :code_string => 'ja')
10    @dv_encapsulated = DvEncapsulated.new(:value => dummy,
11                                          :charset => charset,
12                                          :language => language)
13  end
14
15  it 's value should be test' do
16    @dv_encapsulated.value.should == 'test'
17  end
18
19  it 's size should be 4' do
20    @dv_encapsulated.size.should be_equal 4
21  end
22
23  it 's charset should be utf-8' do
24    @dv_encapsulated.charset.code_string.should == 'UTF-8'
25  end
26
27  it 's langage should be ja' do
28    @dv_encapsulated.language.code_string.should == 'ja'
29  end
30
31  it 'should raise ArgumentError when language is invalid' do
32    wrong_lang = stub(CodePhrase, :code_string => 'jj')
33    lambda {@dv_encapsulated.language = wrong_lang}.
34      should raise_error(ArgumentError)
35  end
36
37  it 'should raise ArgumentError when charset is invalid' do
38    wrong_charset = stub(CodePhrase, :code_string => 'UBK')
39    lambda {@dv_encapsulated.charset = wrong_charset}.
40      should raise_error(ArgumentError)
41  end
42end
Note: See TracBrowser for help on using the repository browser.