source: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/quantity/dv_ordered_spec.rb@ 243

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

move DvOrdered test to rspec

File size: 1.6 KB
RevLine 
[243]1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::DataTypes::Quantity
3include OpenEHR::RM::DataTypes::Text
4
5describe DvOrdered do
6 before(:each) do
7 @dv_ordered = DvOrdered.new
8 end
9
10 it 'should be an instance of DvOrdered' do
11 @dv_ordered.should be_an_instance_of DvOrdered
12 end
13
14 it 'is_normal? should be false' do
15 @dv_ordered.is_normal?.should be_false
16 end
17
18 it 'should be normal' do
19 normal_code = stub(CodePhrase, :code_string => 'N')
20 @dv_ordered.normal_status = normal_code
21 @dv_ordered.is_normal?.should be_true
22 end
23
24 it 'should not be normal' do
25 abnormal_code = stub(CodePhrase, :code_string => 'H')
26 @dv_ordered.normal_status = abnormal_code
27 @dv_ordered.is_normal?.should_not be_true
28 end
29
30 it 'is_simple? should be true' do
31 @dv_ordered.is_simple?.should be_true
32 end
33
34 it 'is_simple? should be false' do
35 @dv_ordered.other_reference_ranges = 'dummy'
36 @dv_ordered.is_simple?.should be_false
37 end
38
39 it 'should raise ArgumentError' do
40 lambda{
41 @dv_ordered.other_reference_ranges = ''
42 }.should raise_error ArgumentError
43 end
44
45 it 'should be normal in range' do
46 normal_range = stub(DvInterval, :has => true)
47 @dv_ordered.normal_range = normal_range
48 @dv_ordered.is_normal?.should be_true
49 end
50
51 it 'is_strictly_comparable_to should raise ArgumentError' do
52 lambda{
53 @dv_ordered.is_strictly_comparable_to? 'test'
54 }.should raise_error(NotImplementedError)
55 end
56
57 it 'should be raise NotImplemented error' do
58 lambda {
59 @dv_ordered<=>1
60 }.should raise_error(NotImplementedError)
61 end
62end
Note: See TracBrowser for help on using the repository browser.