source: ruby/branches/0.5/spec/lib/open_ehr/rm/common/generic/party_identified_spec.rb@ 322

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

common/generic near completed

File size: 1.9 KB
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2include OpenEHR::RM::Common::Generic
3
4describe PartyIdentified do
5 before(:each) do
6 external_ref = stub(PartyRef, :namespace => 'unknown')
7 identifiers = stub(Array, :size => 5, :empty? => false)
8 @party_identified = PartyIdentified.new(:name => 'NERV',
9 :external_ref => external_ref,
10 :identifier => identifiers)
11 end
12
13 it 'should be an instance of PartyIdentified' do
14 @party_identified.should be_an_instance_of PartyIdentified
15 end
16
17 it 'should assign name properly' do
18 @party_identified.name.should == 'NERV'
19 end
20
21 it 'should assign external_ref properly' do
22 @party_identified.external_ref.namespace.should == 'unknown'
23 end
24
25 it 'should assign identifier properly' do
26 @party_identified.identifier.size.should be_equal 5
27 end
28
29 it 'should raise ArgumentError with all nil' do
30 lambda {
31 PartyIdentified.new
32 }.should raise_error ArgumentError
33 end
34
35 it 'should raise ArgumentError with nil name when ex_r and id nil' do
36 @party_identified.identifier = nil
37 @party_identified.external_ref = nil
38 lambda {
39 @party_identified.name = nil
40 }.should raise_error ArgumentError
41 end
42
43 it 'should raise ArgumentError with nil external_ref when name and id nil' do
44 @party_identified.name = nil
45 @party_identified.identifier = nil
46 lambda {
47 @party_identified.external_ref = nil
48 }.should raise_error ArgumentError
49 end
50
51 it 'should raise ArgumentError with nil identifier when name and ex_r nil' do
52 @party_identified.name = nil
53 @party_identified.external_ref = nil
54 lambda {
55 @party_identified.identifier = nil
56 }.should raise_error ArgumentError
57 end
58
59 it 'should raise ArgumentError with empty identifier' do
60 lambda {
61 @party_identified.identifier = Array.new
62 }.should raise_error ArgumentError
63 end
64end
Note: See TracBrowser for help on using the repository browser.