open_ehr 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +43 -0
- data/Guardfile +9 -0
- data/History.txt +4 -0
- data/Manifest.txt +16 -0
- data/PostInstall.txt +9 -0
- data/README.rdoc +66 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/doc/README_rdoc.html +148 -0
- data/doc/created.rid +2 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +54 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/openehr_terminology.xml +2700 -0
- data/doc/rdoc.css +706 -0
- data/lib/#open_ehr.rb# +11 -0
- data/lib/open_ehr/am/archetype/archetype_description/archetype_description.rb +21 -0
- data/lib/open_ehr/am/archetype/assertion.rb +190 -0
- data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +296 -0
- data/lib/open_ehr/am/archetype/constraint_model.rb +340 -0
- data/lib/open_ehr/am/archetype/ontology.rb +97 -0
- data/lib/open_ehr/am/archetype.rb +134 -0
- data/lib/open_ehr/am/open_ehr_profile/data_types/basic.rb +29 -0
- data/lib/open_ehr/am/open_ehr_profile/data_types/quantity.rb +19 -0
- data/lib/open_ehr/am/open_ehr_profile/data_types/text.rb +12 -0
- data/lib/open_ehr/am.rb +8 -0
- data/lib/open_ehr/assumed_library_types.rb +627 -0
- data/lib/open_ehr/parser/xml_perser.rb +13 -0
- data/lib/open_ehr/parser.rb +19 -0
- data/lib/open_ehr/rm/common/archetyped.rb +182 -0
- data/lib/open_ehr/rm/common/change_control.rb +332 -0
- data/lib/open_ehr/rm/common/directory.rb +29 -0
- data/lib/open_ehr/rm/common/generic.rb +216 -0
- data/lib/open_ehr/rm/common/resource.rb +154 -0
- data/lib/open_ehr/rm/common.rb +14 -0
- data/lib/open_ehr/rm/composition/content/entry.rb +246 -0
- data/lib/open_ehr/rm/composition/content/navigation.rb +31 -0
- data/lib/open_ehr/rm/composition/content.rb +22 -0
- data/lib/open_ehr/rm/composition.rb +103 -0
- data/lib/open_ehr/rm/data_structures/history.rb +117 -0
- data/lib/open_ehr/rm/data_structures/item_structure/representation.rb +63 -0
- data/lib/open_ehr/rm/data_structures/item_structure.rb +216 -0
- data/lib/open_ehr/rm/data_structures.rb +25 -0
- data/lib/open_ehr/rm/data_types/basic.rb +108 -0
- data/lib/open_ehr/rm/data_types/charset.lst +818 -0
- data/lib/open_ehr/rm/data_types/charset_extract.rb +24 -0
- data/lib/open_ehr/rm/data_types/encapsulated.rb +98 -0
- data/lib/open_ehr/rm/data_types/quantity/date_time.rb +229 -0
- data/lib/open_ehr/rm/data_types/quantity.rb +403 -0
- data/lib/open_ehr/rm/data_types/text.rb +168 -0
- data/lib/open_ehr/rm/data_types/time_specification.rb +75 -0
- data/lib/open_ehr/rm/data_types/uri.rb +82 -0
- data/lib/open_ehr/rm/data_types.rb +14 -0
- data/lib/open_ehr/rm/demographic.rb +269 -0
- data/lib/open_ehr/rm/ehr.rb +162 -0
- data/lib/open_ehr/rm/integration.rb +27 -0
- data/lib/open_ehr/rm/security.rb +12 -0
- data/lib/open_ehr/rm/support/assumed_types.rb +81 -0
- data/lib/open_ehr/rm/support/definition.rb +15 -0
- data/lib/open_ehr/rm/support/identification.rb +408 -0
- data/lib/open_ehr/rm/support/measurement.rb +17 -0
- data/lib/open_ehr/rm/support/terminology.rb +135 -0
- data/lib/open_ehr/rm/support.rb +14 -0
- data/lib/open_ehr/rm.rb +16 -0
- data/lib/open_ehr/serializer.rb +272 -0
- data/lib/open_ehr/terminology/open_ehr_terminology.rb +41 -0
- data/lib/open_ehr/terminology.rb +7 -0
- data/lib/open_ehr/writer.rb +12 -0
- data/lib/open_ehr.rb +11 -0
- data/spec/lib/open_ehr/am/archetype/archetype_spec.rb +98 -0
- data/spec/lib/open_ehr/am/archetype/assertion/assertion_spec.rb +60 -0
- data/spec/lib/open_ehr/am/archetype/assertion/assertion_variable_spec.rb +30 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_binary_operator.rb +40 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_item_spec.rb +28 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_leaf_spec.rb +34 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_operator_spec.rb +25 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_unary_operator_spec.rb +26 -0
- data/spec/lib/open_ehr/am/archetype/assertion/operator_kind_spec.rb +110 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_constraint_spec.rb +56 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_internal_ref_spec.rb +36 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_slot_spec.rb +61 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_attribute_spec.rb +59 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_complex_object_spec.rb +39 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb +53 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_domain_type_spec.rb +25 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_multiple_attribute_spec.rb +29 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_object_spec.rb +61 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_primitive_object_spec.rb +33 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_reference_object_spec.rb +17 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_single_attribute_spec.rb +28 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/cardinality_spec.rb +68 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/constraint_ref_spec.rb +29 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_boolean_spec.rb +52 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_spec.rb +80 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_time_spec.rb +106 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_duration_spec.rb +69 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_integer_spec.rb +62 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_primitive_spec.rb +39 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_real_spec.rb +14 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_string_spec.rb +69 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_time_spec.rb +79 -0
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +59 -0
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb +43 -0
- data/spec/lib/open_ehr/am/archetype/validity_kind_spec.rb +42 -0
- data/spec/lib/open_ehr/assumed_library_types/interval_spec.rb +140 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_date_spec.rb +236 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_date_time_spec.rb +47 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_duration_spec.rb +150 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_time_spec.rb +234 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_timezone_spec.rb +57 -0
- data/spec/lib/open_ehr/assumed_library_types/time_definitions_spec.rb +136 -0
- data/spec/lib/open_ehr/rm/common/archetyped/archetyped_spec.rb +50 -0
- data/spec/lib/open_ehr/rm/common/archetyped/feeder_audit_details_spec.rb +60 -0
- data/spec/lib/open_ehr/rm/common/archetyped/feeder_audit_spec.rb +51 -0
- data/spec/lib/open_ehr/rm/common/archetyped/link_spec.rb +42 -0
- data/spec/lib/open_ehr/rm/common/archetyped/locatable_spec.rb +89 -0
- data/spec/lib/open_ehr/rm/common/archetyped/pathable_spec.rb +42 -0
- data/spec/lib/open_ehr/rm/common/change_control/contribution_spec.rb +56 -0
- data/spec/lib/open_ehr/rm/common/change_control/imported_version_spec.rb +63 -0
- data/spec/lib/open_ehr/rm/common/change_control/original_version_spec.rb +71 -0
- data/spec/lib/open_ehr/rm/common/change_control/version_spec.rb +92 -0
- data/spec/lib/open_ehr/rm/common/change_control/versioned_object_spec.rb +285 -0
- data/spec/lib/open_ehr/rm/common/directory/folder_spec.rb +26 -0
- data/spec/lib/open_ehr/rm/common/generic/attestation_spec.rb +62 -0
- data/spec/lib/open_ehr/rm/common/generic/audit_details_spec.rb +51 -0
- data/spec/lib/open_ehr/rm/common/generic/participation_spec.rb +36 -0
- data/spec/lib/open_ehr/rm/common/generic/party_identified_spec.rb +64 -0
- data/spec/lib/open_ehr/rm/common/generic/party_proxy_spec.rb +18 -0
- data/spec/lib/open_ehr/rm/common/generic/party_related_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/common/generic/revision_history_item_spec.rb +43 -0
- data/spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb +45 -0
- data/spec/lib/open_ehr/rm/common/resource/authored_resource_spec.rb +68 -0
- data/spec/lib/open_ehr/rm/common/resource/resource_description_item_spec.rb +105 -0
- data/spec/lib/open_ehr/rm/common/resource/resource_description_spec.rb +74 -0
- data/spec/lib/open_ehr/rm/common/resource/translation_details_spec.rb +35 -0
- data/spec/lib/open_ehr/rm/composition/composition_spec.rb +92 -0
- data/spec/lib/open_ehr/rm/composition/content/content_item_spec.rb +14 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/action_spec.rb +69 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/activity_spec.rb +61 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/admin_entry_spec.rb +38 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/care_entry_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/entry_spec.rb +88 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/evaluation_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/instruction_details_spec.rb +51 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/instruction_spec.rb +62 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/ism_transition_spec.rb +46 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb +45 -0
- data/spec/lib/open_ehr/rm/composition/content/navigation/section_spec.rb +32 -0
- data/spec/lib/open_ehr/rm/composition/event_context_spec.rb +88 -0
- data/spec/lib/open_ehr/rm/data_structures/data_structure_spec.rb +21 -0
- data/spec/lib/open_ehr/rm/data_structures/history/event_spec.rb +44 -0
- data/spec/lib/open_ehr/rm/data_structures/history/history_spec.rb +67 -0
- data/spec/lib/open_ehr/rm/data_structures/history/interval_event_spec.rb +43 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_list_spec.rb +53 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_single_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb +147 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_tree_spec.rb +48 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/representation/cluster_spec.rb +26 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/representation/element_spec.rb +22 -0
- data/spec/lib/open_ehr/rm/data_types/basic/data_value_spec.rb +17 -0
- data/spec/lib/open_ehr/rm/data_types/basic/dv_boolean_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/data_types/basic/dv_identifier_spec.rb +108 -0
- data/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb +44 -0
- data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_encapsulated_spec.rb +42 -0
- data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_multimedia_spec.rb +79 -0
- data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_parsable_spec.rb +34 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_spec.rb +64 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb +25 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_tempral_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_time_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb +35 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_amount_spec.rb +105 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_count_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_interval_spec.rb +17 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_ordered_spec.rb +60 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_ordinal_spec.rb +74 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_proportion_spec.rb +162 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_quantified_spec.rb +36 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_quantity_spec.rb +78 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/proportion_kind_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb +43 -0
- data/spec/lib/open_ehr/rm/data_types/text/code_phrase_spec.rb +23 -0
- data/spec/lib/open_ehr/rm/data_types/text/dv_paragraph_spec.rb +13 -0
- data/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb +57 -0
- data/spec/lib/open_ehr/rm/data_types/text/term_mapping_spec.rb +59 -0
- data/spec/lib/open_ehr/rm/data_types/uri/dv_ehr_uri_spec.rb +21 -0
- data/spec/lib/open_ehr/rm/data_types/uri/dv_uri_spec.rb +36 -0
- data/spec/lib/open_ehr/rm/demographic/actor_spec.rb +79 -0
- data/spec/lib/open_ehr/rm/demographic/address_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/demographic/capability_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/demographic/contact_spec.rb +45 -0
- data/spec/lib/open_ehr/rm/demographic/party_identity_spec.rb +32 -0
- data/spec/lib/open_ehr/rm/demographic/party_relationship_spec.rb +84 -0
- data/spec/lib/open_ehr/rm/demographic/party_spec.rb +133 -0
- data/spec/lib/open_ehr/rm/demographic/role_spec.rb +58 -0
- data/spec/lib/open_ehr/rm/ehr/ehr_access_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/ehr/ehr_spec.rb +139 -0
- data/spec/lib/open_ehr/rm/ehr/ehr_status_spec.rb +52 -0
- data/spec/lib/open_ehr/rm/ehr/versioned_composition_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/integration/generic_entry_spec.rb +31 -0
- data/spec/lib/open_ehr/rm/support/identification/access_group_ref_spec.rb +19 -0
- data/spec/lib/open_ehr/rm/support/identification/archetype_id_spec.rb +152 -0
- data/spec/lib/open_ehr/rm/support/identification/generic_id_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/support/identification/hier_object_id_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/internet_id_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/iso_oid_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/locatable_ref_spec.rb +34 -0
- data/spec/lib/open_ehr/rm/support/identification/object_id_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/support/identification/object_ref_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/support/identification/object_version_id_spec.rb +60 -0
- data/spec/lib/open_ehr/rm/support/identification/party_ref_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/support/identification/template_id_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/terminology_id_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/support/identification/uid_based_id_spec.rb +50 -0
- data/spec/lib/open_ehr/rm/support/identification/uid_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/support/identification/version_tree_id_spec.rb +104 -0
- data/spec/lib/open_ehr/rm/support/measurement_service_spec.rb +7 -0
- data/spec/lib/open_ehr/rm/support/terminology_service_spec.rb +24 -0
- data/spec/lib/open_ehr/serializer/adl-test-entry.most_minimal.test.adl +20 -0
- data/spec/lib/open_ehr/serializer/adl_serializer_spec.rb +47 -0
- data/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl +38 -0
- data/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.xml +58 -0
- data/spec/lib/open_ehr/serializer/sample_archetype_spec.rb +44 -0
- data/spec/lib/open_ehr/serializer/xml_serializer_spec.rb +49 -0
- data/spec/lib/open_ehr/terminology/open_ehr_terminology_spec.rb +40 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +54 -0
- metadata +401 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Resource
|
3
|
+
include OpenEHR::RM::Common::ChangeControl
|
4
|
+
include OpenEHR::RM::DataTypes::Text
|
5
|
+
|
6
|
+
describe AuthoredResource do
|
7
|
+
before(:each) do
|
8
|
+
original_language = stub(CodePhrase, :code_string => 'ja')
|
9
|
+
translation_language = stub(CodePhrase, :code_string => 'en')
|
10
|
+
translation_details = stub(TranslationDetails,
|
11
|
+
:language => translation_language)
|
12
|
+
translations = Hash['en', translation_details]
|
13
|
+
description = stub(ResourceDescription, :lifecycle_state => 'initial')
|
14
|
+
revision_history = stub(RevisionHistory, :most_recent_version => '0.0.3')
|
15
|
+
languages_available = Set.new %w(ja en)
|
16
|
+
@authored_resource = AuthoredResource.new(
|
17
|
+
:original_language => original_language,
|
18
|
+
:translations => translations,
|
19
|
+
:description => description,
|
20
|
+
:revision_history => revision_history)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should be an instance of AuthoredResource' do
|
24
|
+
@authored_resource.should be_an_instance_of AuthoredResource
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'original language should be ja' do
|
28
|
+
@authored_resource.original_language.code_string.should == 'ja'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'translations hash en returns en detail' do
|
32
|
+
@authored_resource.translations['en'].language.code_string.should == 'en'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'description lifecycle_state should e initial' do
|
36
|
+
@authored_resource.description.lifecycle_state.should == 'initial'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'language_available should be Set(%(ja en))' do
|
40
|
+
languages_set = Set.new ['ja', 'en']
|
41
|
+
@authored_resource.languages_available.should == languages_set
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'current_revision should be 0.0.3' do
|
45
|
+
@authored_resource.current_revision.should == '0.0.3'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should be controlled' do
|
49
|
+
@authored_resource.is_controlled?.should be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should not be controlled' do
|
53
|
+
@authored_resource.revision_history = nil
|
54
|
+
@authored_resource.is_controlled?.should be_false
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should raise ArgumentError with empty translations' do
|
58
|
+
lambda {
|
59
|
+
@authored_resource.translations = Array.new
|
60
|
+
}.should raise_error ArgumentError
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should raise ArgumentError when original language is nil' do
|
64
|
+
lambda {
|
65
|
+
@authored_resource.original_language = nil
|
66
|
+
}.should raise_error ArgumentError
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Resource
|
3
|
+
include OpenEHR::RM::DataTypes::Text
|
4
|
+
|
5
|
+
describe ResourceDescriptionItem do
|
6
|
+
before(:each) do
|
7
|
+
language = stub(CodePhrase, :defining_code => 'ja')
|
8
|
+
original_resource_uri = {'jp' => 'http://openehr.jp/'}
|
9
|
+
@resource_description_item =
|
10
|
+
ResourceDescriptionItem.new(:language => language,
|
11
|
+
:purpose => 'test',
|
12
|
+
:keywords => ['openehr'],
|
13
|
+
:use => 'development',
|
14
|
+
:misuse => 'none',
|
15
|
+
:copyright => 'Shinji KOBAYASHI',
|
16
|
+
:original_resource_uri => original_resource_uri,
|
17
|
+
:other_details => {'charset' => 'UTF-8'})
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should be an instance of ResourceDescriptionItem' do
|
21
|
+
@resource_description_item.should be_an_instance_of ResourceDescriptionItem
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'language should ja' do
|
25
|
+
@resource_description_item.language.defining_code.should == 'ja'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'purpose should be test' do
|
29
|
+
@resource_description_item.purpose.should == 'test'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should raise ArgumentError with nil purpose' do
|
33
|
+
lambda {
|
34
|
+
@resource_description_item.purpose = nil
|
35
|
+
}.should raise_error ArgumentError
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should raise ArgumentError with empty purpose' do
|
39
|
+
lambda {
|
40
|
+
@resource_description_item.purpose = ''
|
41
|
+
}.should raise_error ArgumentError
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'keywords should [openehr]' do
|
45
|
+
@resource_description_item.keywords.should == ['openehr']
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'use should be development' do
|
49
|
+
@resource_description_item.use.should == 'development'
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should raise ArgumentError with use is empty' do
|
53
|
+
lambda {
|
54
|
+
@resource_description_item.use = ''
|
55
|
+
}.should raise_error ArgumentError
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should not raise ArgumentError with nil use' do
|
59
|
+
lambda {
|
60
|
+
@resource_description_item.use = nil
|
61
|
+
}.should_not raise_error ArgumentError
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'misuse should be none' do
|
65
|
+
@resource_description_item.misuse.should == 'none'
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should raise ArgumentError with empty misuse' do
|
69
|
+
lambda {
|
70
|
+
@resource_description_item.misuse = ''
|
71
|
+
}.should raise_error ArgumentError
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should not raise ArgumentError with nil misuse' do
|
75
|
+
lambda {
|
76
|
+
@resource_description_item.misuse = nil
|
77
|
+
}.should_not raise_error ArgumentError
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'copyright should be Shinji KOBAYASHI' do
|
81
|
+
@resource_description_item.copyright.should == 'Shinji KOBAYASHI'
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should raise error with empty copyright' do
|
85
|
+
lambda {
|
86
|
+
@resource_description_item.copyright = ''
|
87
|
+
}.should raise_error ArgumentError
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should not raise ArgumentError with nil copyright' do
|
91
|
+
lambda {
|
92
|
+
@resource_description_item.copyright = nil
|
93
|
+
}.should_not raise_error ArgumentError
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'original_resource_uri should {jp, http://openehr.jp/}' do
|
97
|
+
@resource_description_item.original_resource_uri.should ==
|
98
|
+
{'jp' => 'http://openehr.jp/'}
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'other_details should {charset, UTF-8}' do
|
102
|
+
@resource_description_item.other_details.should ==
|
103
|
+
{'charset' => 'UTF-8'}
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Resource
|
3
|
+
|
4
|
+
describe ResourceDescription do
|
5
|
+
before(:each) do
|
6
|
+
original_author = {'Shinji KOBAYASHI' => 'Ehime University'}
|
7
|
+
other_contributors = ['Akimichi TATSUKAWA']
|
8
|
+
resource_description_item =
|
9
|
+
stub(ResourceDescriptionItem, :purpose => 'test')
|
10
|
+
details = {'case' => resource_description_item}
|
11
|
+
other_details = {'charset' => 'UTF-8'}
|
12
|
+
parent_resource = stub(AuthoredResource, :current_revision => '0.0.3')
|
13
|
+
@resource_description =
|
14
|
+
ResourceDescription.new(:original_author => original_author,
|
15
|
+
:other_contributors => other_contributors,
|
16
|
+
:lifecycle_state => 'initial',
|
17
|
+
:details => details,
|
18
|
+
:other_details => other_details,
|
19
|
+
:resource_package_uri => 'http://openehr.jp/',
|
20
|
+
:parent_resource => parent_resource)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should be an instance of ResourceDescription' do
|
24
|
+
@resource_description.should be_an_instance_of ResourceDescription
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'original author should be Shinji KOBAYASHI' do
|
28
|
+
@resource_description.original_author.keys[0].should ==
|
29
|
+
'Shinji KOBAYASHI'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'other_contributors should be Akimichi TATSUKAWA' do
|
33
|
+
@resource_description.other_contributors[0].should ==
|
34
|
+
'Akimichi TATSUKAWA'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'lifecycle_state should be initial' do
|
38
|
+
@resource_description.lifecycle_state.should == 'initial'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'details key should be case' do
|
42
|
+
@resource_description.details.keys[0].should == 'case'
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'other_details value should be charset, UTF-8' do
|
46
|
+
@resource_description.other_details.should == {'charset' => 'UTF-8'}
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'resource package uri should be http://openehr.jp/' do
|
50
|
+
@resource_description.resource_package_uri.should == 'http://openehr.jp/'
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'parent_resource current_revision should be 0.0.3' do
|
54
|
+
@resource_description.parent_resource.current_revision.should == '0.0.3'
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should raise ArgumentError with nil original author' do
|
58
|
+
lambda {
|
59
|
+
@resource_description.original_author = nil
|
60
|
+
}.should raise_error ArgumentError
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should raise ArgumentError with nil lifecycle_state' do
|
64
|
+
lambda {
|
65
|
+
@resource_description.lifecycle_state = nil
|
66
|
+
}.should raise_error ArgumentError
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should raise ArgumentError with nil details' do
|
70
|
+
lambda {
|
71
|
+
@resource_description.details = {}
|
72
|
+
}.should raise_error ArgumentError
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Resource
|
3
|
+
include OpenEHR::RM::DataTypes::Text
|
4
|
+
|
5
|
+
describe TranslationDetails do
|
6
|
+
before(:each) do
|
7
|
+
language = stub(CodePhrase, :code_string => 'ja')
|
8
|
+
author = Hash['Shinji KOBAYASHI', 'Ehime University']
|
9
|
+
@translation_details =
|
10
|
+
TranslationDetails.new(:language => language,
|
11
|
+
:author => author,
|
12
|
+
:accreditation => 'skoba@moss.gr.jp',
|
13
|
+
:other_details => {'ja' => 'Japanese'})
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should be an instance of TranslationDetails' do
|
17
|
+
@translation_details.should be_an_instance_of TranslationDetails
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'language should be ja' do
|
21
|
+
@translation_details.language.code_string.should == 'ja'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'authour should be Shinji KOBAYASHI' do
|
25
|
+
@translation_details.author.keys[0].should == 'Shinji KOBAYASHI'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'accreditation should be skoba@moss.gr.jp' do
|
29
|
+
@translation_details.accreditation.should == 'skoba@moss.gr.jp'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'other_details should ja, Japanese' do
|
33
|
+
@translation_details.other_details.values[0].should == 'Japanese'
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Composition
|
3
|
+
include OpenEHR::RM::DataTypes::Text
|
4
|
+
include OpenEHR::RM::Support::Identification
|
5
|
+
include OpenEHR::RM::Common::Generic
|
6
|
+
|
7
|
+
describe Composition do
|
8
|
+
before(:each) do
|
9
|
+
name = DvText.new(:value => 'composition test')
|
10
|
+
language = stub(CodePhrase, :code_string => 'ja')
|
11
|
+
category = stub(DvCodedText, :value => 'event')
|
12
|
+
territory = stub(CodePhrase, :code_string => 'jpn')
|
13
|
+
external_ref = stub(PartyRef, :type => 'ROLE')
|
14
|
+
composer = stub(PartyProxy, :external_ref => external_ref)
|
15
|
+
content = stub(Array, :size => 3)
|
16
|
+
context = stub(EventContext, :location => 'lab1')
|
17
|
+
@composition = Composition.new(:archetype_node_id => 'at0001',
|
18
|
+
:name => name,
|
19
|
+
:language => language,
|
20
|
+
:category => category,
|
21
|
+
:territory => territory,
|
22
|
+
:composer => composer,
|
23
|
+
:content => content,
|
24
|
+
:context => context)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should be an instance of Composition' do
|
28
|
+
@composition.should be_an_instance_of Composition
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'language should be assigned properly' do
|
32
|
+
@composition.language.code_string.should == 'ja'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should validate language with Termonology service'
|
36
|
+
|
37
|
+
it 'should raise ArgumentError with nil language' do
|
38
|
+
lambda {
|
39
|
+
@composition.language = nil
|
40
|
+
}.should raise_error ArgumentError
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'category should be assigned properly' do
|
44
|
+
@composition.category.value.should == 'event'
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should validate category with Terminology service'
|
48
|
+
|
49
|
+
it 'should raise ArgumentError with nil category' do
|
50
|
+
lambda {
|
51
|
+
@composition.category = nil
|
52
|
+
}.should raise_error ArgumentError
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'territory should be assined properly' do
|
56
|
+
@composition.territory.code_string.should == 'jpn'
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should raise ArgumentError with nil territory' do
|
60
|
+
lambda {
|
61
|
+
@composition.territory = nil
|
62
|
+
}.should raise_error ArgumentError
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'composer should be assigned properly' do
|
66
|
+
@composition.composer.external_ref.type.should == 'ROLE'
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should raise ArgumentError with nil comosser' do
|
70
|
+
lambda {
|
71
|
+
@composition.composer = nil
|
72
|
+
}.should raise_error ArgumentError
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'is_persistent? should be false when category is not persistent' do
|
76
|
+
@composition.is_persistent?.should be_false
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'is_persistent? should be true when category is persistent' do
|
80
|
+
category = stub(DvCodedText, :value => 'persistent')
|
81
|
+
@composition.category = category
|
82
|
+
@composition.is_persistent?.should be_true
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'content should be assigned properly' do
|
86
|
+
@composition.content.size.should == 3
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'context should be assigned properly' do
|
90
|
+
@composition.context.location.should == 'lab1'
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Composition::Content
|
3
|
+
include OpenEHR::RM::DataTypes::Text
|
4
|
+
|
5
|
+
describe ContentItem do
|
6
|
+
before(:each) do
|
7
|
+
@content_item = ContentItem.new(:name => DvText.new(:value => 'item'),
|
8
|
+
:archetype_node_id => 'at0001')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be an instance of ContentItem' do
|
12
|
+
@content_item.should be_an_instance_of ContentItem
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
2
|
+
#require File.dirname(__FILE__) + '/shared_examples_spec'
|
3
|
+
include OpenEHR::RM::Composition::Content::Entry
|
4
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
5
|
+
include OpenEHR::RM::DataTypes::Text
|
6
|
+
include OpenEHR::RM::DataStructures::ItemStructure
|
7
|
+
|
8
|
+
describe Action do
|
9
|
+
let(:name) {DvText.new(:value => 'entry package')}
|
10
|
+
let(:language) { double('language',:code_string => 'ja')}
|
11
|
+
let(:encoding) { double('encoding', :code_string => 'UTF-8')}
|
12
|
+
let(:subject) { double('PartyProxy')}
|
13
|
+
# it_should_behave_like 'entry'
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
time = DvDateTime.new(:value => '2009-11-18T20:17:18')
|
17
|
+
description = stub(ItemStructure, :archetype_node_id => 'at0002')
|
18
|
+
current_state = stub(DvCodedText, :value => 'planned')
|
19
|
+
ism_transition = stub(IsmTransition, :current_state => current_state)
|
20
|
+
instruction_details = stub(InstructionDetails, :activity_id => 'at0003')
|
21
|
+
@action= Action.new(:archetype_node_id => 'at0001',
|
22
|
+
:name => name,
|
23
|
+
:language => language,
|
24
|
+
:encoding => encoding,
|
25
|
+
:subject => subject,
|
26
|
+
:time => time,
|
27
|
+
:description => description,
|
28
|
+
:ism_transition => ism_transition,
|
29
|
+
:instruction_details => instruction_details)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should be an instance of Action' do
|
33
|
+
@action.should be_an_instance_of Action
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'time should be assigned properly' do
|
37
|
+
@action.time.value.should == '2009-11-18T20:17:18'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should raise ArgumentError with nil assigned to time' do
|
41
|
+
lambda {
|
42
|
+
@action.time = nil
|
43
|
+
}.should raise_error ArgumentError
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'description should assigned properly' do
|
47
|
+
@action.description.archetype_node_id.should == 'at0002'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should raise ArgumentError with nil description' do
|
51
|
+
lambda {
|
52
|
+
@action.description = nil
|
53
|
+
}.should raise_error ArgumentError
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'ism_transition should be assigned properly' do
|
57
|
+
@action.ism_transition.current_state.value.should == 'planned'
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should raise ArgumentError with nil ism_transition' do
|
61
|
+
lambda {
|
62
|
+
@action.ism_transition = nil
|
63
|
+
}.should raise_error ArgumentError
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'instruction_details should be assigned properly' do
|
67
|
+
@action.instruction_details.activity_id.should == 'at0003'
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
2
|
+
#require File.dirname(__FILE__) + '/shared_examples_spec'
|
3
|
+
include OpenEHR::RM::DataStructures::ItemStructure
|
4
|
+
include OpenEHR::RM::Composition::Content::Entry
|
5
|
+
include OpenEHR::RM::DataTypes::Encapsulated
|
6
|
+
include OpenEHR::RM::DataTypes::Text
|
7
|
+
|
8
|
+
describe Activity do
|
9
|
+
# it_should_behave_like 'entry'
|
10
|
+
let(:name) {DvText.new(:value => 'entry package')}
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
description = stub(ItemStructure, :archetype_node_id => 'at0002')
|
14
|
+
timing = stub(DvParsable, :value => '2009-11-18T19:35:11')
|
15
|
+
@activity = Activity.new(:archetype_node_id => 'at0001',
|
16
|
+
:name => name,
|
17
|
+
:description => description,
|
18
|
+
:timing => timing,
|
19
|
+
:action_archetype_id => '/at.+/')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should be an instance of Activity' do
|
23
|
+
@activity.should be_an_instance_of Activity
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'description should be assigned properly' do
|
27
|
+
@activity.description.archetype_node_id.should == 'at0002'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should raise ArgumentError with nil description' do
|
31
|
+
lambda {
|
32
|
+
@activity.description = nil
|
33
|
+
}.should raise_error ArgumentError
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'timing should be assigned properly' do
|
37
|
+
@activity.timing.value.should == '2009-11-18T19:35:11'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should raise ArgumentError with nil timing' do
|
41
|
+
lambda {
|
42
|
+
@activity.timing = nil
|
43
|
+
}.should raise_error ArgumentError
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'action_archetype_id should be assigned properly' do
|
47
|
+
@activity.action_archetype_id.should == '/at.+/'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should raise ArgumentError with nil action_archetype_id' do
|
51
|
+
lambda {
|
52
|
+
@activity.action_archetype_id = nil
|
53
|
+
}.should raise_error ArgumentError
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should raise ArgumentError with empty action_archetype_id' do
|
57
|
+
lambda {
|
58
|
+
@activity.action_archetype_id = ''
|
59
|
+
}.should raise_error ArgumentError
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
2
|
+
#require File.dirname(__FILE__) + '/shared_examples_spec'
|
3
|
+
include OpenEHR::RM::Composition::Content::Entry
|
4
|
+
include OpenEHR::RM::DataTypes::Text
|
5
|
+
include OpenEHR::RM::Common::Generic
|
6
|
+
include OpenEHR::RM::DataStructures::ItemStructure
|
7
|
+
|
8
|
+
describe AdminEntry do
|
9
|
+
let(:name) {DvText.new(:value => 'entry package')}
|
10
|
+
let(:language) { double('language',:code_string => 'ja')}
|
11
|
+
let(:encoding) { double('encoding', :code_string => 'UTF-8')}
|
12
|
+
let(:subject) { double('PartyProxy')}
|
13
|
+
# it_should_behave_like 'entry'
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
data = stub(ItemStructure, :archetype_node_id => 'at0002')
|
17
|
+
@admin_entry = AdminEntry.new(:archetype_node_id => 'at0001',
|
18
|
+
:name => DvText.new(:value => 'admin entry'),
|
19
|
+
:language => language,
|
20
|
+
:encoding => encoding,
|
21
|
+
:subject => subject,
|
22
|
+
:data => data)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should be an instance of AdminEntry' do
|
26
|
+
@admin_entry.should be_an_instance_of AdminEntry
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'data should be assigned properly' do
|
30
|
+
@admin_entry.data.archetype_node_id.should == 'at0002'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should raise ArgumentError when nil assigned to data' do
|
34
|
+
lambda {
|
35
|
+
@admin_entry.data = nil
|
36
|
+
}.should raise_error ArgumentError
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
2
|
+
#require File.dirname(__FILE__) + '/shared_examples_spec'
|
3
|
+
include OpenEHR::RM::Composition::Content::Entry
|
4
|
+
include OpenEHR::RM::DataTypes::Text
|
5
|
+
include OpenEHR::RM::DataStructures::ItemStructure
|
6
|
+
include OpenEHR::RM::Support::Identification
|
7
|
+
|
8
|
+
describe CareEntry do
|
9
|
+
let(:language) { double('language',:code_string => 'ja')}
|
10
|
+
let(:encoding) { double('encoding', :code_string => 'UTF-8')}
|
11
|
+
let(:subject) { double('PartyProxy')}
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
protocol = stub(ItemStructure, :archetype_node_id => 'at0003')
|
15
|
+
guideline_id = stub(ObjectRef, :type => 'care guideline')
|
16
|
+
@care_entry = CareEntry.new(:archetype_node_id => 'at0001',
|
17
|
+
:name => DvText.new(:value => 'care entry'),
|
18
|
+
:language => language,
|
19
|
+
:encoding => encoding,
|
20
|
+
:subject => subject,
|
21
|
+
:protocol => protocol,
|
22
|
+
:guideline_id => guideline_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should be an instance of CareEntry' do
|
26
|
+
@care_entry.should be_an_instance_of CareEntry
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'protocol should be assigned properly' do
|
30
|
+
@care_entry.protocol.archetype_node_id.should == 'at0003'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'guideline should be assined properly' do
|
34
|
+
@care_entry.guideline_id.type.should == 'care guideline'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Composition::Content::Entry
|
3
|
+
include OpenEHR::RM::DataTypes::Text
|
4
|
+
include OpenEHR::RM::Common::Generic
|
5
|
+
|
6
|
+
describe Entry do
|
7
|
+
|
8
|
+
let(:name) {DvText.new(:value => 'entry package')}
|
9
|
+
let(:language) { double('language',:code_string => 'ja')}
|
10
|
+
let(:encoding) { double('encoding', :code_string => 'UTF-8')}
|
11
|
+
let(:subject) { double('PartyProxy')}
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
external_ref = stub(PartyRef, :type => 'entry')
|
15
|
+
subject = PartyProxy.new(:external_ref => external_ref)
|
16
|
+
provider_external_ref = stub(PartyRef, :type => 'provider')
|
17
|
+
provider = PartyProxy.new(:external_ref => provider_external_ref)
|
18
|
+
other_participations = stub(Array, :size => 3, :empty? => false)
|
19
|
+
workflow_id = stub(ObjectRef, :type => 'workflow')
|
20
|
+
@entry = Entry.new(:archetype_node_id => 'at0001',
|
21
|
+
:name => DvText.new(:value => 'entry test'),
|
22
|
+
:language => language,
|
23
|
+
:encoding => encoding,
|
24
|
+
:subject => subject,
|
25
|
+
:provider => provider,
|
26
|
+
:other_participations => other_participations,
|
27
|
+
:workflow_id => workflow_id)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should be an instance of Entry' do
|
31
|
+
@entry.should be_an_instance_of Entry
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'language should be assigned properly' do
|
35
|
+
@entry.language.code_string.should == 'ja'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should raise ArgumentError when nil assign to language' do
|
39
|
+
lambda {
|
40
|
+
@entry.language = nil
|
41
|
+
}.should raise_error ArgumentError
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should raise ArgumentError with invalid language code'
|
45
|
+
|
46
|
+
it 'encoding should be assigned properly' do
|
47
|
+
@entry.encoding.code_string.should == 'UTF-8'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should raise ArgumentError when nil assign to encoding' do
|
51
|
+
lambda {
|
52
|
+
@entry.encoding = nil
|
53
|
+
}.should raise_error ArgumentError
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should raise ArgumentError with invalid encoding'
|
57
|
+
|
58
|
+
it 'subject should be assigned properly' do
|
59
|
+
@entry.subject.external_ref.type.should == 'entry'
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should raise ArgumentError when nil assigned to subject' do
|
63
|
+
lambda {
|
64
|
+
@entry.subject = nil
|
65
|
+
}.should raise_error ArgumentError
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'provider should be assigned properly' do
|
69
|
+
@entry.provider.external_ref.type.should == 'provider'
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'other_participations should be assigned properly' do
|
73
|
+
@entry.other_participations.size.should be_equal 3
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'workflow_id should assigned properly' do
|
77
|
+
@entry.workflow_id.type.should == 'workflow'
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'subject_is_self? should be determined by subject class' do
|
81
|
+
@entry.subject_is_self?.should be_false
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'subject_is_self? should be true when subject is instance of PartySelf' do
|
85
|
+
@entry.subject = PartySelf.new
|
86
|
+
@entry.subject_is_self?.should be_true
|
87
|
+
end
|
88
|
+
end
|