open_ehr 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/Gemfile.lock +22 -20
  2. data/README.rdoc +4 -3
  3. data/Rakefile +0 -5
  4. data/VERSION +1 -1
  5. data/lib/open_ehr/parser/adl_grammar.tt +30 -23
  6. data/lib/open_ehr/parser/cadl_grammar.tt +85 -59
  7. data/lib/open_ehr/parser/cadl_node.rb +18 -0
  8. data/lib/open_ehr/parser/dadl_grammar.tt +1 -1
  9. data/lib/open_ehr/parser/shared_token_grammar.tt +4 -4
  10. data/open_ehr.gemspec +104 -55
  11. data/spec/lib/open_ehr/parser/{adl → adl14}/adl-test-ENTRY.assumed_types.v1.adl +0 -0
  12. data/spec/lib/open_ehr/parser/{adl → adl14}/adl-test-ENTRY.basic_types.v1.adl +0 -0
  13. data/spec/lib/open_ehr/parser/{adl → adl14}/adl-test-ENTRY.basic_types_fail.v1.adl +0 -0
  14. data/spec/lib/open_ehr/parser/{adl → adl14}/adl-test-ENTRY.most_minimal.v1.adl +0 -0
  15. data/spec/lib/open_ehr/parser/{adl → adl14}/adl-test-ENTRY.structure_test1.v1.adl +0 -0
  16. data/spec/lib/open_ehr/parser/adl14/adl-test-SOME_TYPE.generic_type_basic.draft.adl +56 -0
  17. data/spec/lib/open_ehr/parser/adl14/adl-test-SOME_TYPE.generic_type_use_node.draft.adl +63 -0
  18. data/spec/lib/open_ehr/parser/adl14/adl-test-car.paths.test.adl +80 -0
  19. data/spec/lib/open_ehr/parser/adl14/adl-test-car.use_node.test.adl +87 -0
  20. data/spec/lib/open_ehr/parser/adl14/adl-test-composition.dv_coded_text.test.adl +29 -0
  21. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_bindings.test.adl +47 -0
  22. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_desc_missing_purpose.test.adl +45 -0
  23. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_description.test.adl +61 -0
  24. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_description2.test.adl +45 -0
  25. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_identification.test.adl +26 -0
  26. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_internal_ref.test.adl +36 -0
  27. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_internal_ref2.test.adl +36 -0
  28. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_language.test.adl +47 -0
  29. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_language_no_accreditation.test.adl +38 -0
  30. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_language_order_of_translation_details.test.adl +40 -0
  31. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_ontology.test.adl +25 -0
  32. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_slot.test.adl +40 -0
  33. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_slot.test2.adl +37 -0
  34. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_uncommonkeys.test.adl +29 -0
  35. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.basic_types.test.adl +272 -0
  36. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_code_phrase.test.adl +77 -0
  37. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_ordinal.test.adl +66 -0
  38. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_empty.test.adl +46 -0
  39. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full.test.adl +64 -0
  40. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full2.test.adl +64 -0
  41. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full3.test.adl +64 -0
  42. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_item_units_only.test.adl +55 -0
  43. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_list.test.adl +58 -0
  44. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_property.test.adl +47 -0
  45. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_reversed.test.adl +59 -0
  46. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.constraint_binding.test.adl +37 -0
  47. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.constraint_ref.test.adl +43 -0
  48. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.datetime.test.adl +183 -0
  49. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.domain_types.test.adl +97 -0
  50. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.durations.test.adl +111 -0
  51. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.empty_other_contributors.test.adl +42 -0
  52. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.missing_language.test.adl +23 -0
  53. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.mixed_node_types.draft.adl +61 -0
  54. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.most_minimal.test.adl +23 -0
  55. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.multi_language.test.adl +52 -0
  56. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.special_string.test.adl +88 -0
  57. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.structure_test1.test.adl +45 -0
  58. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.structure_test2.test.adl +45 -0
  59. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.term_binding.test.adl +37 -0
  60. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.term_binding2.test.adl +32 -0
  61. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.testtranslations.test.adl +83 -0
  62. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.translations_author_language.test.adl +34 -0
  63. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.translations_language_author.test.adl +34 -0
  64. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.unicode_BOM_support.test.adl +41 -0
  65. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.unicode_support.test.adl +41 -0
  66. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ACTION.imaging.v1.adl +0 -0
  67. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ACTION.referral.v1.adl +0 -0
  68. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl +0 -0
  69. data/spec/lib/open_ehr/parser/adl14/openEHR-EHR-CLUSTER.auscultation.v1.adl +48 -0
  70. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl +0 -0
  71. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.dimensions.v1.adl +0 -0
  72. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl +0 -0
  73. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-chest.v1.adl +0 -0
  74. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-fetus.v1.adl +0 -0
  75. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl +0 -0
  76. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl +0 -0
  77. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl +0 -0
  78. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-generic.v1.adl +0 -0
  79. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl +0 -0
  80. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl +0 -0
  81. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-CLUSTER.exam-uterus.v1.adl +0 -0
  82. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-COMPOSITION.discharge.v1draft.adl +0 -0
  83. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-COMPOSITION.encounter.v1draft.adl +0 -0
  84. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-EVALUATION.adverse.v1.adl +0 -0
  85. data/spec/lib/open_ehr/parser/adl14/openEHR-EHR-EVALUATION.columna_vertebral.v1.adl +85 -0
  86. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-INSTRUCTION.medication.v1.adl +0 -0
  87. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-INSTRUCTION.referral.v1.adl +0 -0
  88. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl +0 -0
  89. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ITEM_TREE.follow_up.v1draft.adl +0 -0
  90. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ITEM_TREE.imaging.v1.adl +0 -0
  91. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ITEM_TREE.medication-formulation.v1.adl +0 -0
  92. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ITEM_TREE.medication.v1.adl +0 -0
  93. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-ITEM_TREE.referral.v1.adl +0 -0
  94. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-OBSERVATION.apgar.v1.adl +0 -0
  95. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-OBSERVATION.blood_pressure.v1.adl +0 -0
  96. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl +0 -0
  97. data/spec/lib/open_ehr/parser/adl14/openEHR-EHR-OBSERVATION.testassumedvalue.v1.adl +99 -0
  98. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-SECTION.findings.v1.adl +0 -0
  99. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-SECTION.reason_for_encounter.v1.adl +0 -0
  100. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-SECTION.summary.v1.adl +0 -0
  101. data/spec/lib/open_ehr/parser/{adl → adl14}/openEHR-EHR-SECTION.vital_signs.v1.adl +0 -0
  102. data/spec/lib/open_ehr/parser/adl_parser_spec.rb +2 -2
  103. data/spec/lib/open_ehr/parser/adl_path_spec.rb +180 -0
  104. metadata +132 -83
  105. data/bin/adl_validator.rb +0 -84
  106. data/lib/open_ehr/parser/scanner/adl_scanner.rb +0 -819
  107. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl +0 -217
  108. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-cadl_sample.v1.adl +0 -9
  109. data/spec/rcov.opts +0 -1
@@ -0,0 +1,48 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-CLUSTER.auscultation.v1
3
+
4
+ concept
5
+ [at0000] -- Auscultation
6
+ language
7
+ original_language = <[ISO_639-1::en]>
8
+
9
+ definition
10
+ CLUSTER[at0000] matches { -- Auscultation
11
+ items cardinality matches {0..*; unordered} matches {
12
+ CLUSTER[at0002] occurrences matches {0..1} matches { -- Findings
13
+ items cardinality matches {0..*; unordered} matches {
14
+ CLUSTER[at0009] occurrences matches {0..1} matches { -- Bowel sounds
15
+ items cardinality matches {0..*; unordered} matches {
16
+ ELEMENT[at0074] occurrences matches {0..*} matches { -- Specific Findings
17
+ value matches {
18
+ DV_CODED_TEXT matches {
19
+ defining_code matches {
20
+ [local::
21
+ at0078, -- Absent bowel sounds
22
+ at0079, -- Decreased bowel sounds
23
+ at0080, -- Increased bowel sounds
24
+ at0081] -- Tinkling bowel sounds
25
+ }
26
+ }
27
+ }
28
+ }
29
+ use_node ELEMENT /items[at0004] -- /items[Clinical Description]
30
+ }
31
+ }
32
+
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ ontology
39
+ term_definitions = <
40
+ ["en"] = <
41
+ items = <
42
+ ["at0000"] = <
43
+ text = <"Auscultation">
44
+ description = <"Findings on Auscultation">
45
+ >
46
+ >
47
+ >
48
+ >
@@ -0,0 +1,85 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-EVALUATION.columna_vertebral.v1
3
+
4
+ concept
5
+ [at0000] -- Columna vertebral
6
+ language
7
+ original_language = <[ISO_639-1::es]>
8
+ description
9
+ original_author = <
10
+ ["name"] = <"">
11
+ >
12
+ details = <
13
+ ["es"] = <
14
+ language = <[ISO_639-1::es]>
15
+ purpose = <"Evaluacion de columna vertebral">
16
+ use = <"Evaluacion de columna vertebral">
17
+ misuse = <"">
18
+ >
19
+ >
20
+ lifecycle_state = <"0">
21
+ other_contributors = <>
22
+ other_details = <
23
+ ["references"] = <"">
24
+ ["MD5-CAM-1.0.1"] = <"0CD148BEA5220C93A938A3038D526998">
25
+ >
26
+
27
+ definition
28
+ EVALUATION[at0000] matches { -- Columna vertebral
29
+ data matches {
30
+ ITEM_LIST[at0001] matches { -- Lista
31
+ items cardinality matches {0..*; unordered} matches {
32
+ ELEMENT[at0002] occurrences matches {0..1} matches { -- Exploracion clinica cervical anormal
33
+ value matches {
34
+ DV_BOOLEAN matches {
35
+ value matches {True, False; True}
36
+ }
37
+ }
38
+ }
39
+ ELEMENT[at0003] occurrences matches {0..1} matches { -- Indicacion de collar cervical
40
+ value matches {
41
+ DV_CODED_TEXT matches {
42
+ defining_code matches {
43
+ [local::
44
+ at0004, -- Si
45
+ at0005] -- No
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ ontology
56
+ term_definitions = <
57
+ ["es"] = <
58
+ items = <
59
+ ["at0000"] = <
60
+ text = <"Columna vertebral">
61
+ description = <"Columna vertebral">
62
+ >
63
+ ["at0001"] = <
64
+ text = <"Lista">
65
+ description = <"@ internal @">
66
+ >
67
+ ["at0002"] = <
68
+ text = <"Exploracion clinica cervical anormal">
69
+ description = <"Exploracion clinica cervical anormal">
70
+ >
71
+ ["at0003"] = <
72
+ text = <"Indicacion de collar cervical">
73
+ description = <"Indicacion de collar cervical">
74
+ >
75
+ ["at0004"] = <
76
+ text = <"Si">
77
+ description = <"hay indicacion de collar cervical">
78
+ >
79
+ ["at0005"] = <
80
+ text = <"No">
81
+ description = <"no hay indicacion de collar cervical">
82
+ >
83
+ >
84
+ >
85
+ >
@@ -0,0 +1,99 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-OBSERVATION.testassumedvalue.v1
3
+
4
+ concept
5
+ [at0000] -- Test assumed value
6
+ language
7
+ original_language = <[ISO_639-1::en]>
8
+ description
9
+ original_author = <
10
+ ["name"] = <"">
11
+ >
12
+ details = <
13
+ ["en"] = <
14
+ language = <[ISO_639-1::en]>
15
+ purpose = <"">
16
+ use = <"">
17
+ misuse = <"">
18
+ >
19
+ >
20
+ lifecycle_state = <"0">
21
+ other_contributors = <>
22
+ other_details = <
23
+ ["references"] = <"">
24
+ ["MD5-CAM-1.0.1"] = <"0B09C5A77713C376B458BDB09F83F018">
25
+ >
26
+
27
+ definition
28
+ OBSERVATION[at0000] matches { -- Test assumed value
29
+ data matches {
30
+ HISTORY[at0001] matches { -- Event Series
31
+ events cardinality matches {1..*; unordered} matches {
32
+ EVENT[at0002] occurrences matches {0..1} matches { -- Any event
33
+ data matches {
34
+ ITEM_TREE[at0003] matches { -- Tree
35
+ items cardinality matches {0..*; unordered} matches {
36
+ ELEMENT[at0004] occurrences matches {0..1} matches { -- New element
37
+ value matches {
38
+ DV_BOOLEAN matches {
39
+ value matches {True, False; True}
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ state matches {
47
+ ITEM_TREE[at0005] matches { -- Tree
48
+ items cardinality matches {0..*; unordered} matches {
49
+ ELEMENT[at0006] occurrences matches {0..1} matches { -- New element
50
+ value matches {
51
+ DV_BOOLEAN matches {
52
+ value matches {True, False; True}
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ ontology
66
+ term_definitions = <
67
+ ["en"] = <
68
+ items = <
69
+ ["at0000"] = <
70
+ text = <"Test assumed value">
71
+ description = <"unknown">
72
+ >
73
+ ["at0001"] = <
74
+ text = <"Event Series">
75
+ description = <"@ internal @">
76
+ >
77
+ ["at0002"] = <
78
+ text = <"Any event">
79
+ description = <"*">
80
+ >
81
+ ["at0003"] = <
82
+ text = <"Tree">
83
+ description = <"@ internal @">
84
+ >
85
+ ["at0004"] = <
86
+ text = <"New element">
87
+ description = <"*">
88
+ >
89
+ ["at0005"] = <
90
+ text = <"Tree">
91
+ description = <"@ internal @">
92
+ >
93
+ ["at0006"] = <
94
+ text = <"New element">
95
+ description = <"*">
96
+ >
97
+ >
98
+ >
99
+ >
@@ -8,7 +8,7 @@ include OpenEHR::AM::Archetype::Ontology
8
8
  describe ADLParser do
9
9
 
10
10
  before (:all) do
11
- @adl_dir = File.dirname(__FILE__) + '/adl/'
11
+ @adl_dir = File.dirname(__FILE__) + '/adl14/'
12
12
  end
13
13
 
14
14
  context 'openEHR-EHR-SECTION-summary.v1.adl' do
@@ -39,7 +39,7 @@ describe ADLParser do
39
39
  @archetype.adl_version.should == '1.4'
40
40
  end
41
41
 
42
- it 'concept should be at0000]' do
42
+ it 'concept should be at0000' do
43
43
  @archetype.concept.should == 'at0000'
44
44
  end
45
45
 
@@ -0,0 +1,180 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+ include OpenEHR::Parser
3
+ include OpenEHR::AM::Archetype
4
+ include OpenEHR::AM::Archetype::ConstraintModel
5
+ include OpenEHR::AM::Archetype::Assertion
6
+ include OpenEHR::AM::Archetype::Ontology
7
+
8
+ describe ADLParser do
9
+ before(:all) do
10
+ adl_dir = File.dirname(__FILE__) + '/adl14/'
11
+ adl_path_test_file = 'adl-test-car.paths.test.adl'
12
+ ap = OpenEHR::Parser::ADLParser.new(adl_dir + adl_path_test_file)
13
+ @root = ap.parse.definition
14
+ end
15
+
16
+
17
+ it 'root path is /' do
18
+ @root.path.should == '/'
19
+ end
20
+
21
+ context 'wheels' do
22
+ before(:all) do
23
+ @wheels = @root.attributes[0]
24
+ end
25
+
26
+ it 'wheels path is /wheels' do
27
+ @wheels.path.should == '/wheels'
28
+ end
29
+
30
+ context 'first wheel' do
31
+ before(:all) do
32
+ @first_wheel = @wheels.children[0]
33
+ end
34
+
35
+ it 'path is /wheels[at0001]' do
36
+ @first_wheel.path.should == '/wheels[at0001]'
37
+ end
38
+
39
+ it 'description path is /wheels[at0001]/description' do
40
+ description = @first_wheel.attributes[0]
41
+ description.path.should == '/wheels[at0001]/description'
42
+ end
43
+
44
+ it 'wheel parts path is /wheels[at0001]/parts' do
45
+ wheel_parts = @first_wheel.attributes[1]
46
+ wheel_parts.path.should == '/wheels[at0001]/parts'
47
+ end
48
+
49
+ context 'parts node' do
50
+ before(:all) do
51
+ @parts_node = @first_wheel.attributes[1].children[0]
52
+ end
53
+
54
+ it 'parts node path is /wheels[at0001]/parts[at0002]' do
55
+ @parts_node.path.should == '/wheels[at0001]/parts[at0002]'
56
+ end
57
+
58
+ context 'somthing of wheel part' do
59
+ before(:all) do
60
+ @something = @parts_node.attributes[0]
61
+ end
62
+
63
+ it 'something of WHEEL_PART path is /wheels[at0001]/parts[at0002]/something' do
64
+ @something.path.should == '/wheels[at0001]/parts[at0002]/something'
65
+ end
66
+ end
67
+
68
+ context 'somthing else of wheel part' do
69
+ before(:all) do
70
+ @something_else = @parts_node.attributes[1]
71
+ end
72
+
73
+ it 'something else of WHEEL_PART path is /wheels[at0001]/parts[at0002]/something_else' do
74
+ @something_else.path.should ==
75
+ '/wheels[at0001]/parts[at0002]/something_else'
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ context 'second wheel' do
82
+ before(:all) do
83
+ @second_wheel = @wheels.children[1]
84
+ end
85
+
86
+ it 'path is /wheels[at0003]' do
87
+ @second_wheel.path.should == '/wheels[at0003]'
88
+ end
89
+
90
+ it 'description path is /wheels[at0003]/description' do
91
+ description = @second_wheel.attributes[0]
92
+ description.path.should == '/wheels[at0003]/description'
93
+ end
94
+
95
+ it 'wheel parts path is /wheels[at0003]/parts' do
96
+ wheel_parts = @second_wheel.attributes[1]
97
+ wheel_parts.path.should == '/wheels[at0003]/parts'
98
+ end
99
+
100
+ context 'parts node' do
101
+ before(:all) do
102
+ @parts_node = @second_wheel.attributes[1].children[0]
103
+ end
104
+
105
+ it 'wheel parts node path is /wheels[at0003]/parts' do
106
+ @parts_node.path.should == '/wheels[at0003]/parts'
107
+ end
108
+
109
+ it 'wheel parts node target path is /wheels[at0001]/parts[at0002]' do
110
+ @parts_node.target_path.should == '/wheels[at0001]/parts[at0002]'
111
+ end
112
+ end
113
+ end
114
+
115
+ context 'third wheel' do
116
+ before(:all) do
117
+ @third_wheel = @wheels.children[2]
118
+ end
119
+
120
+ it 'path is /wheels[at0004]' do
121
+ @third_wheel.path.should == '/wheels[at0004]'
122
+ end
123
+
124
+ it 'description path is /wheels[at0004]/description' do
125
+ description = @third_wheel.attributes[0]
126
+ description.path.should == '/wheels[at0004]/description'
127
+ end
128
+
129
+ context 'parts node' do
130
+ before(:all) do
131
+ @parts_node = @third_wheel.attributes[1].children[0]
132
+ end
133
+
134
+ it 'parts node path is /wheels[at0004]/parts' do
135
+ @parts_node.path.should == '/wheels[at0004]/parts'
136
+ end
137
+
138
+ it 'parts node target path is /wheels[at0001]/parts[at0002]' do
139
+ @parts_node.target_path.should == '/wheels[at0001]/parts[at0002]'
140
+ end
141
+ end
142
+ end
143
+
144
+ context 'fourth wheel' do
145
+ before(:all) do
146
+ @fourth_wheel = @wheels.children[3]
147
+ end
148
+
149
+ it 'path is /wheels[at0005]' do
150
+ @fourth_wheel.path.should == '/wheels[at0005]'
151
+ end
152
+
153
+ it 'description path is /wheels[at0005]/description' do
154
+ description = @fourth_wheel.attributes[0]
155
+ description.path.should == '/wheels[at0005]/description'
156
+ end
157
+
158
+ context 'parts node' do
159
+ before(:all) do
160
+ @parts_node = @fourth_wheel.attributes[1].children[0]
161
+ end
162
+
163
+ it 'parts node path is /wheels[at0005]/parts' do
164
+ @parts_node.path.should == '/wheels[at0005]/parts'
165
+ end
166
+
167
+ it 'parts node target path is /engine[at0001]/parts[at0002]' do
168
+ @parts_node.target_path.should == '/engine[at0001]/parts[at0002]'
169
+ end
170
+ end
171
+ end
172
+
173
+ context 'fifhth wheel' do
174
+ it 'fifth wheel is nil' do
175
+ fifth_wheel = @wheels.children[4]
176
+ fifth_wheel.should be_nil
177
+ end
178
+ end
179
+ end
180
+ end