1 | require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
---|
2 | include OpenEHR::RM::DataTypes::Encapsulated
|
---|
3 | include OpenEHR::RM::DataTypes::Text
|
---|
4 | include OpenEHR::RM::DataTypes::Uri
|
---|
5 | include OpenEHR::RM::Support::Identification
|
---|
6 |
|
---|
7 | describe DvMultimedia do
|
---|
8 | before(:each) do
|
---|
9 | media_type = stub(CodePhrase, :code_string => 'text/xml')
|
---|
10 | charset = stub(CodePhrase, :code_string => 'UTF-8')
|
---|
11 | uri = stub(DvUri, :value => 'http://openehr.jp/')
|
---|
12 | data = Array['123412', '123112']
|
---|
13 | compression_algorithm = stub(CodePhrase, :code_string => 'gzip')
|
---|
14 | integrity_check = Array['123456789ABCDEF','DEADBEEF']
|
---|
15 | integrity_check_algorithm = stub(CodePhrase, :code_string => 'SHA-1')
|
---|
16 | alternate_text = 'test'
|
---|
17 | @dv_multimedia = DvMultimedia.new(:value => '<xml>test</xml>',
|
---|
18 | :media_type => media_type,
|
---|
19 | :charset => charset,
|
---|
20 | :uri => uri,
|
---|
21 | :data => data,
|
---|
22 | :compression_algorithm => compression_algorithm,
|
---|
23 | :integrity_check => integrity_check,
|
---|
24 | :integrity_check_algorithm => integrity_check_algorithm,
|
---|
25 | :alternate_text => alternate_text)
|
---|
26 | end
|
---|
27 |
|
---|
28 | it 'should be an instance of DvMultimedia' do
|
---|
29 | @dv_multimedia.should be_an_instance_of DvMultimedia
|
---|
30 | end
|
---|
31 |
|
---|
32 | it 's value should be <xml>test</xml>' do
|
---|
33 | @dv_multimedia.value.should == '<xml>test</xml>'
|
---|
34 | end
|
---|
35 |
|
---|
36 | it 's media_type should be text/xml' do
|
---|
37 | @dv_multimedia.media_type.code_string.should == 'text/xml'
|
---|
38 | end
|
---|
39 |
|
---|
40 | it 's size should be equal 15' do
|
---|
41 | @dv_multimedia.size.should be_equal 15
|
---|
42 | end
|
---|
43 |
|
---|
44 | it 's charset should be UTF-8' do
|
---|
45 | @dv_multimedia.charset.code_string.should == 'UTF-8'
|
---|
46 | end
|
---|
47 |
|
---|
48 | it 's uri value should be http://openehr.jp/ ' do
|
---|
49 | @dv_multimedia.uri.value.should == 'http://openehr.jp/'
|
---|
50 | end
|
---|
51 |
|
---|
52 | it 's data[0] should be 123412' do
|
---|
53 | @dv_multimedia.data[0].should == '123412'
|
---|
54 | end
|
---|
55 |
|
---|
56 | it 's compression_algorithm should be gzip' do
|
---|
57 | @dv_multimedia.compression_algorithm.code_string.should == 'gzip'
|
---|
58 | end
|
---|
59 |
|
---|
60 | it 's integrity_check[1] should be DEADBEEF' do
|
---|
61 | @dv_multimedia.integrity_check[1].should == 'DEADBEEF'
|
---|
62 | end
|
---|
63 |
|
---|
64 | it 's integrity_check_algorithm should be SHA-1' do
|
---|
65 | @dv_multimedia.integrity_check_algorithm.code_string.should == 'SHA-1'
|
---|
66 | end
|
---|
67 |
|
---|
68 | it 's alternate text should be test' do
|
---|
69 | @dv_multimedia.alternate_text.should == 'test'
|
---|
70 | end
|
---|
71 |
|
---|
72 | it 'has_integrity_check should be true'
|
---|
73 |
|
---|
74 | it 'is compressed should be true'
|
---|
75 |
|
---|
76 | it 'is_external should be true'
|
---|
77 |
|
---|
78 | it 'is_internal should be false'
|
---|
79 | end
|
---|