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,285 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
#require File.dirname(__FILE__) + '/shared_examples_spec'
|
3
|
+
include OpenEHR::RM::Common::ChangeControl
|
4
|
+
include OpenEHR::RM::Common::Generic
|
5
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
6
|
+
include OpenEHR::RM::DataTypes::Text
|
7
|
+
|
8
|
+
describe VersionedObject do
|
9
|
+
before(:each) do
|
10
|
+
uid1 = ObjectVersionID.new(:value => 'ABC::DEF::1')
|
11
|
+
defining_code1 = stub(CodePhrase, :code_string => '532')
|
12
|
+
lifecycle_state1 = stub(DvCodedText, :defining_code => defining_code1)
|
13
|
+
time_committed1 = DvDateTime.new(:value => '2008-11-12T18:24:32')
|
14
|
+
audit_details1 = stub(AuditDetails, :time_committed => time_committed1)
|
15
|
+
version1 = stub(Version, :commit_audit => audit_details1,
|
16
|
+
:lifecycle_state => lifecycle_state1,
|
17
|
+
:uid => uid1)
|
18
|
+
uid2 = ObjectVersionID.new(:value => 'GHI::JKL::2')
|
19
|
+
defining_code2 = stub(CodePhrase, :code_string => '553')
|
20
|
+
lifecycle_state2 = stub(DvCodedText, :defining_code => defining_code2)
|
21
|
+
time_committed2 = DvDateTime.new(:value => '2008-12-12T19:32:14')
|
22
|
+
audit_details2 = stub(AuditDetails, :time_committed => time_committed2)
|
23
|
+
attestation = stub(Attestation)
|
24
|
+
attestations = Array.new([attestation])
|
25
|
+
contribution = stub(ObjectRef, :empty? => false, :type => 'CONTRIBUTION')
|
26
|
+
version2 = OriginalVersion.new(:commit_audit => audit_details2,
|
27
|
+
:lifecycle_state => lifecycle_state2,
|
28
|
+
:preceding_version_uid => uid1,
|
29
|
+
:uid => uid2,
|
30
|
+
:contribution => contribution,
|
31
|
+
:attestations => attestations)
|
32
|
+
uid3 = ObjectVersionID.new(:value => 'MNO::PQR::3')
|
33
|
+
defining_code3 = stub(CodePhrase, :code_string => '523')
|
34
|
+
lifecycle_state3 = stub(DvCodedText, :defining_code => defining_code3)
|
35
|
+
time_committed3 = DvDateTime.new(:value => '2009-07-15T09:24:26')
|
36
|
+
audit_details3 = stub(AuditDetails, :time_committed => time_committed3)
|
37
|
+
version3 = stub(Version, :commit_audit => audit_details3,
|
38
|
+
:lifecycle_state => lifecycle_state3,
|
39
|
+
:uid => uid3)
|
40
|
+
uid = HierObjectID.new(:value => 'STU::VWX::5')
|
41
|
+
owner_id = stub(ObjectRef, :namespace => 'test')
|
42
|
+
time_created = DvDateTime.new(:value => '2009-11-09T09:53:22')
|
43
|
+
object_id = stub(ObjectID, :value => 'unique')
|
44
|
+
all_versions = [version1, version2, version3]
|
45
|
+
@versioned_object = VersionedObject.new(:uid => uid,
|
46
|
+
:owner_id => owner_id,
|
47
|
+
:time_created => time_created,
|
48
|
+
:all_versions => all_versions)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should be an instance of VersionedObject' do
|
52
|
+
@versioned_object.should be_an_instance_of VersionedObject
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'uid value should be STU::VWX::5' do
|
56
|
+
@versioned_object.uid.value.should == 'STU::VWX::5'
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'owner_id namespace should be test' do
|
60
|
+
@versioned_object.owner_id.namespace.should == 'test'
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'all_versions.size should be 3' do
|
64
|
+
@versioned_object.all_versions.size.should == 3
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'version_count should be 3' do
|
68
|
+
@versioned_object.version_count.should == 3
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'time_created should equal 2009-11-09T09:53:22' do
|
72
|
+
@versioned_object.time_created.value.should == '2009-11-09T09:53:22'
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'all_version_ids should return all ids of versions' do
|
76
|
+
ids = @versioned_object.all_version_ids
|
77
|
+
ids.each do |id|
|
78
|
+
%w(ABC::DEF::1 GHI::JKL::2 MNO::PQR::3).should include id.value
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'should have version id ABC::DEF::1' do
|
83
|
+
object_version_id = ObjectVersionID.new(:value => 'ABC::DEF::1')
|
84
|
+
@versioned_object.has_version_id?(object_version_id).should be_true
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should not have version id BCD::EFG::12' do
|
88
|
+
object_version_id = ObjectVersionID.new(:value => 'BCD::EFG::12')
|
89
|
+
@versioned_object.has_version_id?(object_version_id).should be_false
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'ABC::DEF::1 should not be original version' do
|
93
|
+
object_version_id = ObjectVersionID.new(:value => 'ABC::DEF::1')
|
94
|
+
@versioned_object.is_original_version?(object_version_id).should be_false
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'GHI::JKL::2 should be original version' do
|
98
|
+
object_version_id = ObjectVersionID.new(:value => 'GHI::JKL::2')
|
99
|
+
@versioned_object.is_original_version?(object_version_id).should be_true
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should have 2009-07-15T09:24:26 committed version' do
|
103
|
+
exist_time = DvDateTime.new(:value => '2009-07-15T09:24:26')
|
104
|
+
@versioned_object.has_version_at_time?(exist_time).should be_true
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should retrun version3 with id MNO::PQR::3' do
|
108
|
+
uid = ObjectVersionID.new(:value => 'MNO::PQR::3')
|
109
|
+
@versioned_object.version_with_id(uid).commit_audit.time_committed.
|
110
|
+
should == DvDateTime.new(:value => '2009-07-15T09:24:26')
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should return version2 with 2008-12-12T19:32:14' do
|
114
|
+
exist_date = DvDateTime.new(:value => '2008-12-12T19:32:14')
|
115
|
+
@versioned_object.version_at_time(exist_date).lifecycle_state.
|
116
|
+
defining_code.code_string.should == '553'
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'latest_version should return version3' do
|
120
|
+
@versioned_object.latest_version.uid.value.should == 'MNO::PQR::3'
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'latest_trunk_version should return ABC::DEF::1' do
|
124
|
+
@versioned_object.latest_trunk_version.uid.value.should ==
|
125
|
+
'ABC::DEF::1'
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'trunk_lifecycle_state should return 532' do
|
129
|
+
@versioned_object.trunk_lifecycle_state.defining_code.
|
130
|
+
code_string.should == '532'
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'revision_history items are 3' do
|
134
|
+
@versioned_object.revision_history.items.size.should == 3
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'should be able to commit original version' do
|
138
|
+
contribution = stub(ObjectRef, :empty? => false, :type => 'CONTRIBUTION')
|
139
|
+
uid = ObjectVersionID.new(:value => 'EFG::HIJ::7')
|
140
|
+
preceding_version_uid = ObjectVersionID.new(:value => 'ABC::DEF::1')
|
141
|
+
audit = stub(AuditDetails)
|
142
|
+
defining_code = stub(CodePhrase, :code_string => '523')
|
143
|
+
lifecycle_state = stub(DvCodedText, :defining_code => defining_code)
|
144
|
+
attestations = stub(Array, :empty? => false)
|
145
|
+
@versioned_object.
|
146
|
+
commit_original_version(:contribution => contribution,
|
147
|
+
:uid => uid,
|
148
|
+
:preceding_version_uid => preceding_version_uid,
|
149
|
+
:commit_audit => audit,
|
150
|
+
:lifecycle_state => lifecycle_state,
|
151
|
+
:data => 'data',
|
152
|
+
:attestations => attestations,
|
153
|
+
:signature => 'A41bdad')
|
154
|
+
@versioned_object.all_versions.size.should == 4
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'should raise ArgumentError with invalid preceeding version' do
|
158
|
+
contribution = stub(ObjectRef, :empty? => false, :type => 'CONTRIBUTION')
|
159
|
+
uid = ObjectVersionID.new(:value => 'EFG::HIJ::7')
|
160
|
+
preceding_version_uid = ObjectVersionID.new(:value => 'BCD::EFG::8')
|
161
|
+
audit = stub(AuditDetails)
|
162
|
+
defining_code = stub(CodePhrase, :code_string => '523')
|
163
|
+
lifecycle_state = stub(DvCodedText, :defining_code => defining_code)
|
164
|
+
attestations = stub(Array, :empty? => false)
|
165
|
+
lambda {
|
166
|
+
@versioned_object.
|
167
|
+
commit_original_version(:contribution => contribution,
|
168
|
+
:uid => uid,
|
169
|
+
:preceding_version_uid => preceding_version_uid,
|
170
|
+
:commit_audit => audit,
|
171
|
+
:lifecycle_state => lifecycle_state,
|
172
|
+
:data => 'data',
|
173
|
+
:attestations => attestations,
|
174
|
+
:signature => 'A41bdad')
|
175
|
+
}.should raise_error ArgumentError
|
176
|
+
end
|
177
|
+
|
178
|
+
it 'should be able to commit original merged version' do
|
179
|
+
contribution = stub(ObjectRef, :empty? => false, :type => 'CONTRIBUTION')
|
180
|
+
uid = ObjectVersionID.new(:value => 'KLM::NOP::9')
|
181
|
+
preceding_version_uid = ObjectVersionID.new(:value => 'ABC::DEF::1')
|
182
|
+
time_committed = DvDateTime.new(:value => '2009-11-09T23:42:18')
|
183
|
+
audit = stub(AuditDetails, :time_committed => time_committed)
|
184
|
+
defining_code = stub(CodePhrase, :code_string => '523')
|
185
|
+
lifecycle_state = stub(DvCodedText, :defining_code => defining_code)
|
186
|
+
attestations = stub(Array, :empty? => false)
|
187
|
+
@versioned_object.
|
188
|
+
commit_original_merged_version(:contribution => contribution,
|
189
|
+
:uid => uid,
|
190
|
+
:preceding_version_uid => preceding_version_uid,
|
191
|
+
:commit_audit => audit,
|
192
|
+
:lifecycle_state => lifecycle_state,
|
193
|
+
:data => 'merged data',
|
194
|
+
:attestations => attestations,
|
195
|
+
:signature => 'dc3dbdad')
|
196
|
+
@versioned_object.latest_version.data.should == 'merged data'
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'should be able to commit imported_version' do
|
200
|
+
contribution = stub(ObjectRef, :empty? => false, :type => 'CONTRIBUTION')
|
201
|
+
time_committed = DvDateTime.new(:value => '2009-11-09T23:42:18')
|
202
|
+
audit = stub(AuditDetails, :time_committed => time_committed)
|
203
|
+
uid = ObjectVersionID.new(:value => 'QRS::TUV::10')
|
204
|
+
preceding_version_uid = ObjectVersionID.new(:value => 'ABC::DEF::1')
|
205
|
+
defining_code = stub(CodePhrase, :code_string => '523')
|
206
|
+
lifecycle_state = stub(DvCodedText, :defining_code => defining_code)
|
207
|
+
attestations = stub(Array, :empty? => false)
|
208
|
+
original_version = OriginalVersion.new(:uid => uid,
|
209
|
+
:contribution => contribution,
|
210
|
+
:commit_audit => audit,
|
211
|
+
:preceding_version_uid => preceding_version_uid,
|
212
|
+
:data => 'original data',
|
213
|
+
:lifecycle_state => lifecycle_state,
|
214
|
+
:attestations => attestations)
|
215
|
+
@versioned_object.commit_imported_version(:contribution => contribution,
|
216
|
+
:commit_audit => audit,
|
217
|
+
:item => original_version)
|
218
|
+
@versioned_object.latest_version.commit_audit.time_committed.value.
|
219
|
+
should == '2009-11-09T23:42:18'
|
220
|
+
end
|
221
|
+
|
222
|
+
it 'should be able to commit attestation' do
|
223
|
+
attestation = stub(Attestation)
|
224
|
+
uid = ObjectVersionID.new(:value => 'GHI::JKL::2')
|
225
|
+
@versioned_object.commit_attestation(:attestation => attestation,
|
226
|
+
:uid => uid,
|
227
|
+
:signature => 'CDAEbad')
|
228
|
+
@versioned_object.version_with_id(uid).signature.
|
229
|
+
should == 'CDAEbad'
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'should raise ArgumentError when time_created is nil' do
|
233
|
+
lambda {
|
234
|
+
@versioned_object.time_created = nil
|
235
|
+
}.should raise_error ArgumentError
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'should raise ArgumentError when all_versions are nil' do
|
239
|
+
lambda {
|
240
|
+
@versioned_object.all_versions = nil
|
241
|
+
}.should raise_error ArgumentError
|
242
|
+
end
|
243
|
+
|
244
|
+
it 'should raise ArgumentError when is_original_version argument is nil' do
|
245
|
+
lambda {
|
246
|
+
@versioned_object.is_original_version?(nil)
|
247
|
+
}.should raise_error ArgumentError
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'should not has time data' do
|
251
|
+
unexisted_time = DvDateTime.new(:value => '2009-11-10T00:43:59')
|
252
|
+
lambda {
|
253
|
+
@versioned_object.version_at_time(unexisted_time)
|
254
|
+
}.should raise_error ArgumentError
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'should raise ArgumentError with nil argument to commit_attestations' do
|
258
|
+
lambda {
|
259
|
+
@versioned_object.commit_attestation(:attestation => nil)
|
260
|
+
}.should raise_error ArgumentError
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'should raise ArgumentError with not orinigal version id' do
|
264
|
+
uid = ObjectVersionID.new(:value => 'ABC::DEF::1')
|
265
|
+
attestation = stub(Attestation)
|
266
|
+
lambda {
|
267
|
+
@versioned_object.commit_attestation(:attestation => attestation,
|
268
|
+
:uid => uid,
|
269
|
+
:signature => 'DEADBEAFE81')
|
270
|
+
}.should raise_error ArgumentError
|
271
|
+
end
|
272
|
+
|
273
|
+
it 'should raise ArgumentError with nil argument to version with id' do
|
274
|
+
lambda {
|
275
|
+
@versioned_object.version_with_id(nil)
|
276
|
+
}.should raise_error ArgumentError
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'should raise ArgumentError with unexsited version with id ' do
|
280
|
+
uid = ObjectVersionID.new(:value => 'CBA::FED::1')
|
281
|
+
lambda {
|
282
|
+
@versioned_object.version_with_id(uid)
|
283
|
+
}.should raise_error ArgumentError
|
284
|
+
end
|
285
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Directory
|
3
|
+
include OpenEHR::RM::DataTypes::Text
|
4
|
+
|
5
|
+
describe Folder do
|
6
|
+
before(:each) do
|
7
|
+
items = stub(Array, :size => 3)
|
8
|
+
folders = stub(Array, :size => 5, :empty? => false)
|
9
|
+
@folder = Folder.new(:archetype_node_id => 'at0001',
|
10
|
+
:name => DvText.new(:value => 'test'),
|
11
|
+
:items => items,
|
12
|
+
:folders => folders)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should an instance of Folder' do
|
16
|
+
@folder.should be_an_instance_of Folder
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'items size should be 3' do
|
20
|
+
@folder.items.size.should == 3
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'folders size should be 5' do
|
24
|
+
@folder.folders.size.should == 5
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
include OpenEHR::RM::Support::Identification
|
4
|
+
include OpenEHR::RM::DataTypes::Text
|
5
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
6
|
+
include OpenEHR::RM::DataTypes::Encapsulated
|
7
|
+
|
8
|
+
describe Attestation do
|
9
|
+
before(:each) do
|
10
|
+
committer = stub(PartyProxy, :namespace => 'UNKNOWN')
|
11
|
+
change_type = stub(DvCodedText, :value =>'creation')
|
12
|
+
time = stub(DvDateTime, :value => '2009-10-03T16:24:19.0Z')
|
13
|
+
reason = DvText.new(:value => 'signed')
|
14
|
+
items = stub(Set, :empty? => false, :size => 3)
|
15
|
+
attested_view = stub(DvMultimedia, :size => 300)
|
16
|
+
@attestation = Attestation.new(:committer => committer,
|
17
|
+
:change_type => change_type,
|
18
|
+
:time_committed => time,
|
19
|
+
:system_id => 'test',
|
20
|
+
:reason => reason,
|
21
|
+
:proof => 'DEADBEEFBABE',
|
22
|
+
:is_pending => true,
|
23
|
+
:attested_view => attested_view,
|
24
|
+
:items => items)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should be an instance of Attestation' do
|
28
|
+
@attestation.should be_an_instance_of Attestation
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'reason should be signed' do
|
32
|
+
@attestation.reason.value.should == 'signed'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'proof should DEADBEEFBABE' do
|
36
|
+
@attestation.proof.should == 'DEADBEEFBABE'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'attested view size should be 300' do
|
40
|
+
@attestation.attested_view.size.should == 300
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'is_pending? should true' do
|
44
|
+
@attestation.is_pending?.should be_true
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'items size should be 30' do
|
48
|
+
@attestation.items.size.should == 3
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should raise ArgumentError when items are empty' do
|
52
|
+
lambda {
|
53
|
+
@attestation.items = Set.new
|
54
|
+
}.should raise_error ArgumentError
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should not raise ArgumentErro when items are nil' do
|
58
|
+
lambda {
|
59
|
+
@attestation.items = nil
|
60
|
+
}.should_not raise_error ArgumentError
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
include OpenEHR::RM::Support::Identification
|
4
|
+
include OpenEHR::RM::DataTypes::Text
|
5
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
6
|
+
|
7
|
+
describe AuditDetails do
|
8
|
+
before(:each) do
|
9
|
+
committer = stub(PartyProxy, :namespace => 'UNKNOWN')
|
10
|
+
change_type = stub(DvCodedText, :value =>'creation')
|
11
|
+
time = stub(DvDateTime, :value => '2009-10-03T16:24:19.0Z')
|
12
|
+
desc = DvText.new(:value => 'test environment')
|
13
|
+
@audit_details = AuditDetails.new(:system_id => 'MAGI',
|
14
|
+
:committer => committer,
|
15
|
+
:time_committed => time,
|
16
|
+
:change_type => change_type,
|
17
|
+
:description => desc)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should be an instance of AuditDetails' do
|
21
|
+
@audit_details.should be_an_instance_of AuditDetails
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'system_id should be MAGI' do
|
25
|
+
@audit_details.system_id.should == 'MAGI'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'committer namespece should be UNKNOWN' do
|
29
|
+
@audit_details.committer.namespace.should == 'UNKNOWN'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'change_type.value should be creation' do
|
33
|
+
@audit_details.change_type.value.should == 'creation'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'description should be test environment' do
|
37
|
+
@audit_details.description.value.should == 'test environment'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should raise ArgumentError when system_id was assigned nil' do
|
41
|
+
lambda {
|
42
|
+
@audit_details.system_id = nil
|
43
|
+
}.should raise_error ArgumentError
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should raise ArgumentError when time_commited is nil' do
|
47
|
+
lambda {
|
48
|
+
@audit_details.time_committed = nil
|
49
|
+
}.should raise_error ArgumentError
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
|
4
|
+
describe Participation do
|
5
|
+
before(:each) do
|
6
|
+
performer = stub(PartyProxy, :name => 'GEHIRN')
|
7
|
+
function = stub(DvText, :value => 'committer')
|
8
|
+
mode = stub(DvCodedText, :value => 'present')
|
9
|
+
lower = stub(DvDateTime, :value => '2009-10-03T20:33:05')
|
10
|
+
time = stub(DvInterval, :lower => lower)
|
11
|
+
@participation = Participation.new(:performer => performer,
|
12
|
+
:function => function,
|
13
|
+
:mode => mode,
|
14
|
+
:time => time)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should be an instance of Participation' do
|
18
|
+
@participation.should be_an_instance_of Participation
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should assign performer properly' do
|
22
|
+
@participation.performer.name.should == 'GEHIRN'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should assign function properly' do
|
26
|
+
@participation.function.value.should == 'committer'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should assign mode properly' do
|
30
|
+
@participation.mode.value.should == 'present'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should assign time properly' do
|
34
|
+
@participation.time.lower.value.should == '2009-10-03T20:33:05'
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
|
4
|
+
describe 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
|
64
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
include OpenEHR::RM::Support::Identification
|
4
|
+
|
5
|
+
describe PartyProxy do
|
6
|
+
before(:each) do
|
7
|
+
external_ref = stub(PartyRef, :namespace => 'NERV')
|
8
|
+
@party_proxy = PartyProxy.new(:external_ref => external_ref)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be an isntance of PartyProxy' do
|
12
|
+
@party_proxy.should be_an_instance_of PartyProxy
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'exnternal_ref.namespace should be NERV' do
|
16
|
+
@party_proxy.external_ref.namespace.should == 'NERV'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
include OpenEHR::RM::DataTypes::Text
|
4
|
+
describe PartyRelated do
|
5
|
+
before(:each) do
|
6
|
+
relationship = stub(DvCodedText, :value => 'self')
|
7
|
+
@party_related = PartyRelated.new(:name => 'TEST',
|
8
|
+
:relationship => relationship)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be an instance of PartyRelated' do
|
12
|
+
@party_related.should be_an_instance_of PartyRelated
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should assign relationship properly' do
|
16
|
+
@party_related.relationship.value.should == 'self'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should raise ArgumentError when nil is assigned to relationship' do
|
20
|
+
lambda {
|
21
|
+
@party_related.relationship = nil
|
22
|
+
}.should raise_error ArgumentError
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
include OpenEHR::RM::Support::Identification
|
4
|
+
|
5
|
+
describe RevisionHistoryItem do
|
6
|
+
before(:each)do
|
7
|
+
version_id = stub(ObjectVersionID, :object_id => 'RIO')
|
8
|
+
audits = stub(Array, :size => 30, :empty? => false)
|
9
|
+
@revision_history_item =
|
10
|
+
RevisionHistoryItem.new(:version_id => version_id,
|
11
|
+
:audits => audits)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should be an instance of RevisionHistoryItem' do
|
15
|
+
@revision_history_item.should be_an_instance_of RevisionHistoryItem
|
16
|
+
end
|
17
|
+
|
18
|
+
it 's version_id.object_id should be RIO' do
|
19
|
+
@revision_history_item.version_id.object_id.should == 'RIO'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 's audits.size should be 30' do
|
23
|
+
@revision_history_item.audits.size.should be_equal 30
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should raise ArgumentError when nil is assigned to version id' do
|
27
|
+
lambda {
|
28
|
+
@revision_history_item.version_id = nil
|
29
|
+
}.should raise_error ArgumentError
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should raise ArgumentError when nil is assinged to audits' do
|
33
|
+
lambda {
|
34
|
+
@revision_history_item.audits = nil
|
35
|
+
}.should raise_error ArgumentError
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should raise ArgumentError when empty is assinged to audits' do
|
39
|
+
lambda {
|
40
|
+
@revision_history_item.audits = Array.new
|
41
|
+
}.should raise_error ArgumentError
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
include OpenEHR::RM::Common::Generic
|
3
|
+
include OpenEHR::RM::Support::Identification
|
4
|
+
include OpenEHR::RM::DataTypes::Quantity::DateTime
|
5
|
+
|
6
|
+
describe RevisionHistory do
|
7
|
+
before(:each) do
|
8
|
+
version_id = stub(ObjectVersionID, :value => 'ABCD::EFGH::1')
|
9
|
+
committed_time = stub(DvDateTime, :value => '2009-11-02T22:19:34')
|
10
|
+
audit = stub(AuditDetails, :time_committed => committed_time)
|
11
|
+
audits = stub(Array, :first => audit)
|
12
|
+
last_item = stub(RevisionHistoryItem, :version_id => version_id,
|
13
|
+
:audits => audits)
|
14
|
+
items = stub(Array, :size => 128, :empty? => false, :last => last_item)
|
15
|
+
@revision_history = RevisionHistory.new(:items => items)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should be an instance of RevisionHistory' do
|
19
|
+
@revision_history.should be_an_instance_of RevisionHistory
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'items size should return size 128' do
|
23
|
+
@revision_history.items.size.should be_equal 128
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should return the most recent version string' do
|
27
|
+
@revision_history.most_recent_version.should == 'ABCD::EFGH::1'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should return the most recent commited version time string' do
|
31
|
+
@revision_history.most_recent_version_time_committed == '2009-11-02T22:19:34'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should raise ArgumentError when item is nil' do
|
35
|
+
lambda {
|
36
|
+
@revision_history.items = nil
|
37
|
+
}.should raise_error ArgumentError
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should raise ArgumentError when item is empty' do
|
41
|
+
lambda {
|
42
|
+
@revision_history.items = Array.new
|
43
|
+
}.should raise_error ArgumentError
|
44
|
+
end
|
45
|
+
end
|