hippo_eyeDoc 0.0.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.
- checksums.yaml +7 -0
- data/CHANGELOG +124 -0
- data/Gemfile +10 -0
- data/Guardfile +14 -0
- data/LICENSE +24 -0
- data/README.md +385 -0
- data/Rakefile +12 -0
- data/hippo_eyeDoc.gemspec +25 -0
- data/lib/hippo_eyeDoc.rb +15 -0
- data/lib/hippo_eyeDoc/code_lists.rb +10 -0
- data/lib/hippo_eyeDoc/code_lists/claim_adjustment_reason_codes.rb +2252 -0
- data/lib/hippo_eyeDoc/code_lists/claim_status_category_codes.rb +376 -0
- data/lib/hippo_eyeDoc/code_lists/claim_status_codes.rb +5456 -0
- data/lib/hippo_eyeDoc/code_lists/remittance_advice_remark_codes.rb +6280 -0
- data/lib/hippo_eyeDoc/code_lists/service_type_codes.rb +1299 -0
- data/lib/hippo_eyeDoc/code_lists/taxonomy_codes.rb +9224 -0
- data/lib/hippo_eyeDoc/exceptions.rb +10 -0
- data/lib/hippo_eyeDoc/field.rb +149 -0
- data/lib/hippo_eyeDoc/outputters.rb +4 -0
- data/lib/hippo_eyeDoc/outputters/html.rb +39 -0
- data/lib/hippo_eyeDoc/outputters/paper_claim.rb +7 -0
- data/lib/hippo_eyeDoc/outputters/pdf.rb +18 -0
- data/lib/hippo_eyeDoc/outputters/pretty_string.rb +45 -0
- data/lib/hippo_eyeDoc/parser.rb +70 -0
- data/lib/hippo_eyeDoc/parser/segment.rb +35 -0
- data/lib/hippo_eyeDoc/parser/transaction_set.rb +45 -0
- data/lib/hippo_eyeDoc/segments.rb +111 -0
- data/lib/hippo_eyeDoc/segments/AAA.rb +39 -0
- data/lib/hippo_eyeDoc/segments/AK1.rb +31 -0
- data/lib/hippo_eyeDoc/segments/AK2.rb +31 -0
- data/lib/hippo_eyeDoc/segments/AK3.rb +39 -0
- data/lib/hippo_eyeDoc/segments/AK4.rb +59 -0
- data/lib/hippo_eyeDoc/segments/AK5.rb +55 -0
- data/lib/hippo_eyeDoc/segments/AK9.rb +79 -0
- data/lib/hippo_eyeDoc/segments/AMT.rb +31 -0
- data/lib/hippo_eyeDoc/segments/BHT.rb +55 -0
- data/lib/hippo_eyeDoc/segments/BPR.rb +175 -0
- data/lib/hippo_eyeDoc/segments/CAS.rb +159 -0
- data/lib/hippo_eyeDoc/segments/CL1.rb +39 -0
- data/lib/hippo_eyeDoc/segments/CLM.rb +223 -0
- data/lib/hippo_eyeDoc/segments/CLP.rb +119 -0
- data/lib/hippo_eyeDoc/segments/CN1.rb +55 -0
- data/lib/hippo_eyeDoc/segments/CR1.rb +87 -0
- data/lib/hippo_eyeDoc/segments/CR2.rb +103 -0
- data/lib/hippo_eyeDoc/segments/CR3.rb +47 -0
- data/lib/hippo_eyeDoc/segments/CR4.rb +239 -0
- data/lib/hippo_eyeDoc/segments/CR5.rb +151 -0
- data/lib/hippo_eyeDoc/segments/CR6.rb +175 -0
- data/lib/hippo_eyeDoc/segments/CR7.rb +31 -0
- data/lib/hippo_eyeDoc/segments/CR8.rb +79 -0
- data/lib/hippo_eyeDoc/segments/CRC.rb +63 -0
- data/lib/hippo_eyeDoc/segments/CTP.rb +211 -0
- data/lib/hippo_eyeDoc/segments/CTX.rb +99 -0
- data/lib/hippo_eyeDoc/segments/CUR.rb +175 -0
- data/lib/hippo_eyeDoc/segments/DMG.rb +115 -0
- data/lib/hippo_eyeDoc/segments/DN1.rb +39 -0
- data/lib/hippo_eyeDoc/segments/DN2.rb +55 -0
- data/lib/hippo_eyeDoc/segments/DSB.rb +71 -0
- data/lib/hippo_eyeDoc/segments/DTM.rb +55 -0
- data/lib/hippo_eyeDoc/segments/DTP.rb +31 -0
- data/lib/hippo_eyeDoc/segments/EB.rb +207 -0
- data/lib/hippo_eyeDoc/segments/EM.rb +63 -0
- data/lib/hippo_eyeDoc/segments/EQ.rb +135 -0
- data/lib/hippo_eyeDoc/segments/FRM.rb +47 -0
- data/lib/hippo_eyeDoc/segments/GE.rb +23 -0
- data/lib/hippo_eyeDoc/segments/GS.rb +71 -0
- data/lib/hippo_eyeDoc/segments/HCP.rb +127 -0
- data/lib/hippo_eyeDoc/segments/HI.rb +919 -0
- data/lib/hippo_eyeDoc/segments/HL.rb +44 -0
- data/lib/hippo_eyeDoc/segments/HSD.rb +71 -0
- data/lib/hippo_eyeDoc/segments/IEA.rb +23 -0
- data/lib/hippo_eyeDoc/segments/III.rb +195 -0
- data/lib/hippo_eyeDoc/segments/IK3.rb +39 -0
- data/lib/hippo_eyeDoc/segments/IK4.rb +59 -0
- data/lib/hippo_eyeDoc/segments/IK5.rb +55 -0
- data/lib/hippo_eyeDoc/segments/IMM.rb +55 -0
- data/lib/hippo_eyeDoc/segments/INS.rb +171 -0
- data/lib/hippo_eyeDoc/segments/ISA.rb +136 -0
- data/lib/hippo_eyeDoc/segments/K3.rb +147 -0
- data/lib/hippo_eyeDoc/segments/LE.rb +15 -0
- data/lib/hippo_eyeDoc/segments/LIN.rb +255 -0
- data/lib/hippo_eyeDoc/segments/LQ.rb +23 -0
- data/lib/hippo_eyeDoc/segments/LS.rb +15 -0
- data/lib/hippo_eyeDoc/segments/LX.rb +20 -0
- data/lib/hippo_eyeDoc/segments/MEA.rb +219 -0
- data/lib/hippo_eyeDoc/segments/MIA.rb +199 -0
- data/lib/hippo_eyeDoc/segments/MOA.rb +79 -0
- data/lib/hippo_eyeDoc/segments/MPI.rb +63 -0
- data/lib/hippo_eyeDoc/segments/MSG.rb +31 -0
- data/lib/hippo_eyeDoc/segments/N1.rb +55 -0
- data/lib/hippo_eyeDoc/segments/N2.rb +23 -0
- data/lib/hippo_eyeDoc/segments/N3.rb +23 -0
- data/lib/hippo_eyeDoc/segments/N4.rb +63 -0
- data/lib/hippo_eyeDoc/segments/NM1.rb +103 -0
- data/lib/hippo_eyeDoc/segments/NTE.rb +23 -0
- data/lib/hippo_eyeDoc/segments/OI.rb +55 -0
- data/lib/hippo_eyeDoc/segments/PAT.rb +79 -0
- data/lib/hippo_eyeDoc/segments/PCT.rb +23 -0
- data/lib/hippo_eyeDoc/segments/PDP.rb +31 -0
- data/lib/hippo_eyeDoc/segments/PDR.rb +39 -0
- data/lib/hippo_eyeDoc/segments/PER.rb +79 -0
- data/lib/hippo_eyeDoc/segments/PID.rb +79 -0
- data/lib/hippo_eyeDoc/segments/PKD.rb +47 -0
- data/lib/hippo_eyeDoc/segments/PLB.rb +191 -0
- data/lib/hippo_eyeDoc/segments/PRV.rb +75 -0
- data/lib/hippo_eyeDoc/segments/PS1.rb +31 -0
- data/lib/hippo_eyeDoc/segments/PWK.rb +115 -0
- data/lib/hippo_eyeDoc/segments/QTY.rb +155 -0
- data/lib/hippo_eyeDoc/segments/RDM.rb +135 -0
- data/lib/hippo_eyeDoc/segments/REF.rb +83 -0
- data/lib/hippo_eyeDoc/segments/SBR.rb +79 -0
- data/lib/hippo_eyeDoc/segments/SD1.rb +71 -0
- data/lib/hippo_eyeDoc/segments/SE.rb +23 -0
- data/lib/hippo_eyeDoc/segments/ST.rb +31 -0
- data/lib/hippo_eyeDoc/segments/STC.rb +187 -0
- data/lib/hippo_eyeDoc/segments/SV1.rb +263 -0
- data/lib/hippo_eyeDoc/segments/SV2.rb +147 -0
- data/lib/hippo_eyeDoc/segments/SV3.rb +219 -0
- data/lib/hippo_eyeDoc/segments/SV4.rb +211 -0
- data/lib/hippo_eyeDoc/segments/SV5.rb +123 -0
- data/lib/hippo_eyeDoc/segments/SV6.rb +151 -0
- data/lib/hippo_eyeDoc/segments/SV7.rb +55 -0
- data/lib/hippo_eyeDoc/segments/SVC.rb +183 -0
- data/lib/hippo_eyeDoc/segments/SVD.rb +115 -0
- data/lib/hippo_eyeDoc/segments/TA1.rb +46 -0
- data/lib/hippo_eyeDoc/segments/TOO.rb +67 -0
- data/lib/hippo_eyeDoc/segments/TRN.rb +39 -0
- data/lib/hippo_eyeDoc/segments/TS2.rb +159 -0
- data/lib/hippo_eyeDoc/segments/TS3.rb +199 -0
- data/lib/hippo_eyeDoc/segments/UR.rb +23 -0
- data/lib/hippo_eyeDoc/segments/VEH.rb +159 -0
- data/lib/hippo_eyeDoc/segments/base.rb +190 -0
- data/lib/hippo_eyeDoc/separator.rb +79 -0
- data/lib/hippo_eyeDoc/transaction_sets.rb +16 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270.rb +15 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000A.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000B.rb +42 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000C.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2000D.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100A.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100B.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100C.rb +97 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2100D.rb +0 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2110C.rb +67 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/L2110D.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_270/base.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271.rb +19 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000A.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000B.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000C.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2000D.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100A.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100B.rb +67 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100C.rb +124 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2100D.rb +124 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2110C.rb +98 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2110D.rb +98 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2115C.rb +16 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2115D.rb +16 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2120C.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/L2120D.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_271/base.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276.rb +19 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000A.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000B.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000C.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000D.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2000E.rb +50 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100A.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100B.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100C.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100D.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2100E.rb +20 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2200D.rb +117 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2200E.rb +117 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2210D.rb +37 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/L2210E.rb +37 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_276/base.rb +90 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277.rb +22 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000A.rb +42 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000B.rb +42 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000C.rb +52 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000D.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2000E.rb +40 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100A.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100B.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100C.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100D.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2100E.rb +20 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200A.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200B.rb +69 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200C.rb +79 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200D.rb +77 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2200E.rb +104 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2220D.rb +57 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/L2220E.rb +44 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_277/base.rb +70 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835.rb +10 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L1000A.rb +74 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L1000B.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2000.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2100.rb +213 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/L2110.rb +106 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_835/base.rb +122 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L1000A.rb +32 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L1000B.rb +21 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000A.rb +88 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000B.rb +87 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2000C.rb +54 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AA.rb +65 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AB.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010AC.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010BA.rb +76 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010BB.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2010CA.rb +76 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2300.rb +570 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310A.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310B.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310C.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310D.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310E.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2310F.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2320.rb +157 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330A.rb +45 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330B.rb +96 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330C.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330D.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330E.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330F.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2330G.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2400.rb +537 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2410.rb +36 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420A.rb +41 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420B.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420C.rb +44 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420D.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420E.rb +55 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420F.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420G.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2420H.rb +34 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2430.rb +47 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/L2440.rb +26 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_837/base.rb +71 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997.rb +7 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/L2000.rb +36 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/L2100.rb +29 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_997/base.rb +49 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999.rb +8 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2000 - AK2.rb +30 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2000AK2.rb +36 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2100 - AK2.rb +37 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2100AK2.rb +43 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2110 - AK2.rb +23 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/L2110AK2.rb +26 -0
- data/lib/hippo_eyeDoc/transaction_sets/HIPAA_999/base.rb +49 -0
- data/lib/hippo_eyeDoc/transaction_sets/base.rb +236 -0
- data/lib/hippo_eyeDoc/transaction_sets/component.rb +96 -0
- data/lib/hippo_eyeDoc/transaction_sets/repeating_component.rb +48 -0
- data/lib/hippo_eyeDoc/utilities.rb +37 -0
- data/lib/hippo_eyeDoc/version.rb +3 -0
- data/samples/005010X221A1_business_scenario_1.edi +1 -0
- data/samples/005010X221A1_tmhp_example.edi +1 -0
- data/samples/005010X222A1_anesthesia.edi +1 -0
- data/samples/005010X222A1_commercial_health_insurance.edi +1 -0
- data/samples/005010X231A1_01.edi +11 -0
- data/samples/005010X231A1_02.edi +11 -0
- data/samples/200823.EDI +22 -0
- data/samples/837_L2000A_01.edi +1 -0
- data/samples/837_L2000A_02.edi +1 -0
- data/samples/parse_277.rb +127 -0
- data/samples/parse_999.rb +122 -0
- data/samples/sample835.html +1 -0
- data/samples/sample835.pretty_string +28 -0
- data/samples/sample837.html +1 -0
- data/test/test_helper.rb +155 -0
- data/test/test_hipaa_835.rb +229 -0
- data/test/test_hipaa_837.rb +596 -0
- data/test/test_html_outputter.rb +22 -0
- data/test/test_parser.rb +138 -0
- data/test/test_pretty_string_outputter.rb +33 -0
- data/test/test_segments_base.rb +201 -0
- data/test/test_transaction_sets_base.rb +122 -0
- metadata +356 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
class TestHTMLOutputter < MiniTest::Unit::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
@parser = Hippo_eyeDoc::Parser.new
|
|
6
|
+
@sample_835 = @parser.parse_file('samples/005010X221A1_business_scenario_1.edi').first
|
|
7
|
+
@sample_837 = @parser.parse_file('samples/005010X231A1_01.edi').first
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def test_segment_to_html_returns_segment_to_s
|
|
11
|
+
assert_equal @sample_835.BPR.to_s, @sample_835.BPR.to_html
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_transaction_to_html_returns_string
|
|
15
|
+
assert_kind_of String, @sample_835.to_html
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_verify_output_against_known_good_html
|
|
19
|
+
assert_equal File.read('samples/sample835.html'), @sample_835.to_html
|
|
20
|
+
assert_equal File.read('samples/sample837.html'), @sample_837.to_html
|
|
21
|
+
end
|
|
22
|
+
end
|
data/test/test_parser.rb
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
class TestParser < MiniTest::Unit::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
@parser = Hippo_eyeDoc::Parser.new
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def test_parse_returns_array_of_transaction_sets
|
|
9
|
+
transaction_sets = @parser.parse_file('samples/005010X221A1_business_scenario_1.edi')
|
|
10
|
+
|
|
11
|
+
assert_instance_of Array, transaction_sets
|
|
12
|
+
|
|
13
|
+
transaction_sets.each do |ts|
|
|
14
|
+
assert_kind_of Hippo_eyeDoc::TransactionSets::Base, ts
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_raises_error_on_extra_segments
|
|
19
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
20
|
+
ts.ST
|
|
21
|
+
ts.TSS.Field2 = 'Bar'
|
|
22
|
+
ts.TSS.Field3 = 'Baz'
|
|
23
|
+
ts.TCS.Field1 = 'Blah'
|
|
24
|
+
ts.TCS.CompositeCommonName_02 = 'CNBlah'
|
|
25
|
+
ts.TSS_02.Field2 = 'Boo'
|
|
26
|
+
|
|
27
|
+
# test nested block syntax on non-looping component
|
|
28
|
+
ts.L0001.TSS.Field2 = 'SubBar'
|
|
29
|
+
|
|
30
|
+
# test nested block syntax on non-looping component
|
|
31
|
+
ts.L0002 do |l0002|
|
|
32
|
+
l0002.TCS.Field2 = 'SubBarBlah'
|
|
33
|
+
l0002.TSS.Field2 = 'SubBarRepeater'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#'TSS*Blah*Bar*Baz~TCS*Blah*:::CNBlah*Preset Field 7~TSS*Last Segment*Boo~TSS*Foo*SubBar~TCS*:SubBarBlah**Foo2~TSS*Last Segment*SubBarRepeater~', ts.to_s
|
|
37
|
+
|
|
38
|
+
ts_result = @parser.parse_string(ts.to_s).first
|
|
39
|
+
|
|
40
|
+
assert_equal ts.values.to_s, ts_result.values.to_s
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_reads_separators_from_isa
|
|
44
|
+
@parser.parse_file('samples/005010X231A1_01.edi')
|
|
45
|
+
|
|
46
|
+
assert_equal '*', @parser.field_separator
|
|
47
|
+
assert_equal '^', @parser.repetition_separator
|
|
48
|
+
assert_equal ':', @parser.composite_separator
|
|
49
|
+
assert_equal '~', @parser.segment_separator
|
|
50
|
+
|
|
51
|
+
@parser = Hippo_eyeDoc::Parser.new
|
|
52
|
+
transaction_set = @parser.parse_file('samples/005010X231A1_02.edi')
|
|
53
|
+
|
|
54
|
+
assert_equal '!', @parser.field_separator
|
|
55
|
+
assert_equal '@', @parser.repetition_separator
|
|
56
|
+
assert_equal '~', @parser.composite_separator
|
|
57
|
+
assert_equal '^', @parser.segment_separator
|
|
58
|
+
|
|
59
|
+
assert_equal transaction_set.first.ST.ST01, '999'
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_adds_enveloping_to_transaction_set
|
|
63
|
+
transaction_set = @parser.parse_file('samples/005010X231A1_01.edi').first
|
|
64
|
+
|
|
65
|
+
assert_equal 445289179, transaction_set.ISA.ISA13
|
|
66
|
+
assert_equal 1, transaction_set.GS.GS06
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def test_parses_repeating_loops
|
|
70
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
71
|
+
ts.ST
|
|
72
|
+
[1,2,3,4,5].each do |i|
|
|
73
|
+
ts.TSS.build do |tss|
|
|
74
|
+
tss.Field2 = 'Bar' + i.to_s
|
|
75
|
+
tss.Field3 = 'Baz' + i.to_s
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
ts.TCS.Field1 = 'Blah'
|
|
80
|
+
ts.TSS_02.Field2 = 'Boo'
|
|
81
|
+
ts.SE.SE01 = ts.segment_count
|
|
82
|
+
|
|
83
|
+
# ST*Test~TSS*Blah*Bar1*Baz1~TSS*Blah*Bar2*Baz2~TSS*Blah*Bar3*Baz3~TSS*Blah*Bar4*Baz4~TSS*Blah*Bar5*Baz5~TCS*Blah**Preset Field 7~TSS*Last Standalone Segment*Boo~SE**Test
|
|
84
|
+
assert_equal ts.values.to_s, @parser.parse_string(ts.to_s).first.values.to_s
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_parses_partial_transaction_set
|
|
88
|
+
ts_01 = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
89
|
+
ts_01.L0002 do |l0002|
|
|
90
|
+
l0002.TCS.Field2 = 'SubBarBlah'
|
|
91
|
+
l0002.TSS.Field2 = 'SubBarRepeater'
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# TCS*:SubBarBlah**Foo2~TSS*Last Segment*SubBarRepeater~
|
|
95
|
+
ts_02 = Hippo_eyeDoc::TransactionSets::Test::L0002.new
|
|
96
|
+
ts_02.parse(ts_01.to_s)
|
|
97
|
+
|
|
98
|
+
assert_equal ts_01.L0002.values.to_s, ts_02.values.to_s
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def test_parse_l2000a
|
|
102
|
+
files = ['samples/837_L2000A_01.edi', 'samples/837_L2000A_02.edi']
|
|
103
|
+
files.each do |f|
|
|
104
|
+
l2000a = Hippo_eyeDoc::TransactionSets::HIPAA_837::L2000A.new.parse(File.read(f))
|
|
105
|
+
|
|
106
|
+
# when L2000B HL04 is '0' we must have a L2000C child
|
|
107
|
+
if l2000a.L2000B.HL.HL04 == '0'
|
|
108
|
+
assert_nil l2000a.L2000B.L2000C.HL.HL02
|
|
109
|
+
else
|
|
110
|
+
assert_equal l2000a.L2000B.HL.HL01, l2000a.L2000B.L2000C.HL.HL02
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def test_same_child_exists_in_multiple_levels
|
|
116
|
+
no_child_loop_string = "TSS*HAS NO CHILD LOOP~TSS*Multiple Parents~"
|
|
117
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::L0004.new
|
|
118
|
+
|
|
119
|
+
ts.parse(no_child_loop_string)
|
|
120
|
+
assert_equal 'TSS*Multiple Parents~', ts.values[1].TSS.to_s
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
child_loop_string = "TSS*HAS CHILD LOOP~TSS*Multiple Parents~"
|
|
124
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::L0004.new
|
|
125
|
+
|
|
126
|
+
ts.parse(child_loop_string)
|
|
127
|
+
assert_equal 'TSS*Multiple Parents~', ts.values[2].to_s
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def test_strips_leading_whitespace_from_segment_identifier
|
|
131
|
+
initial_string = " ST*Test~\n TSS*Blah*BOOM~"
|
|
132
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
133
|
+
|
|
134
|
+
ts.parse(initial_string)
|
|
135
|
+
|
|
136
|
+
assert_equal ts.TSS.TSS02, 'BOOM'
|
|
137
|
+
end
|
|
138
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
class TestPrettyStringOutputter < MiniTest::Unit::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
@ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
6
|
+
@ts.parse('ST*Test~TSS*Blah*Bar*Baz~TCS*Blah*:::CNBlah*Preset Field 7~TSS*Last Standalone Segment*Boo~TSS*Foo*SubBar~TCS*:SubBarBlah**Foo2~TSS*Last Segment*SubBarRepeater~')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def test_segment_to_pretty_string_returns_segment_to_s
|
|
10
|
+
assert_equal @ts.TSS.to_s + "\n", @ts.TSS.to_pretty_string
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_transaction_to_pretty_string_returns_proper_value
|
|
14
|
+
expected_output = <<-EOF
|
|
15
|
+
ST*Test~
|
|
16
|
+
TSS*Blah*Bar*Baz~
|
|
17
|
+
TCS*Blah*:::CNBlah*Preset Field 7~
|
|
18
|
+
TSS*Last Standalone Segment*Boo~
|
|
19
|
+
TSS*Foo*SubBar~
|
|
20
|
+
TCS*:SubBarBlah**Foo2~
|
|
21
|
+
TSS*Last Segment*SubBarRepeater~
|
|
22
|
+
EOF
|
|
23
|
+
|
|
24
|
+
assert_equal expected_output, @ts.to_pretty_string
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_sample835_output
|
|
28
|
+
sample_835 = Hippo_eyeDoc::TransactionSets::HIPAA_835::Base.new
|
|
29
|
+
sample_835.parse(File.read('samples/005010X221A1_business_scenario_1.edi'))
|
|
30
|
+
|
|
31
|
+
assert_equal File.read('samples/sample835.pretty_string'), sample_835.to_pretty_string
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
class TestSegmentsBase < MiniTest::Unit::TestCase
|
|
4
|
+
def setup; end;
|
|
5
|
+
def teardown; end;
|
|
6
|
+
|
|
7
|
+
def test_empty_segment
|
|
8
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
9
|
+
|
|
10
|
+
assert_equal '', seg.to_s
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_basic_populated_segment
|
|
14
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
15
|
+
|
|
16
|
+
seg.Field1 = 'TestField1'
|
|
17
|
+
seg.Field2 = 'TestField2'
|
|
18
|
+
seg.Field3 = 'TestField3'
|
|
19
|
+
seg.Field4 = 'TestField4'
|
|
20
|
+
|
|
21
|
+
assert_equal 'TSS*TestField1*TestField2*TestField3*TestField4~', seg.to_s
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_empty_field_in_segment
|
|
25
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
26
|
+
|
|
27
|
+
seg.Field2 = 'TestField2'
|
|
28
|
+
seg.Field3 = 'TestField3'
|
|
29
|
+
seg.Field4 = 'TestField4'
|
|
30
|
+
|
|
31
|
+
assert_equal 'TSS**TestField2*TestField3*TestField4~', seg.to_s
|
|
32
|
+
|
|
33
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
34
|
+
|
|
35
|
+
seg.Field2 = 'TestField2'
|
|
36
|
+
|
|
37
|
+
assert_equal 'TSS**TestField2~', seg.to_s
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_segment_orders_properly
|
|
41
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
42
|
+
|
|
43
|
+
seg.Field3 = 'TestField3'
|
|
44
|
+
seg.Field2 = 'TestField2'
|
|
45
|
+
seg.Field1 = 'TestField1'
|
|
46
|
+
seg.Field4 = 'TestField4'
|
|
47
|
+
|
|
48
|
+
assert_equal 'TSS*TestField1*TestField2*TestField3*TestField4~', seg.to_s
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_assign_values_with_same_field_names
|
|
52
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
53
|
+
seg.CommonName = 'Value1'
|
|
54
|
+
seg.CommonName_02 = 'Value2'
|
|
55
|
+
|
|
56
|
+
assert_equal 'TSS*****Value1*Value2~', seg.to_s
|
|
57
|
+
|
|
58
|
+
seg.CommonName_01 = 'Value3'
|
|
59
|
+
seg.CommonName_02 = 'Value4'
|
|
60
|
+
|
|
61
|
+
assert_equal 'TSS*****Value3*Value4~', seg.to_s
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_compound_segment
|
|
65
|
+
seg = Hippo_eyeDoc::Segments::TCS.new
|
|
66
|
+
|
|
67
|
+
seg.Field1 = 'Comp1Field1'
|
|
68
|
+
seg.Field2 = 'Comp1Field2'
|
|
69
|
+
|
|
70
|
+
assert_equal 'TCS*Comp1Field1:Comp1Field2~', seg.to_s
|
|
71
|
+
|
|
72
|
+
seg.Field7 = 'Field7'
|
|
73
|
+
|
|
74
|
+
assert_equal 'TCS*Comp1Field1:Comp1Field2**Field7~', seg.to_s
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_compound_segment_with_empty_initial_fields
|
|
78
|
+
seg = Hippo_eyeDoc::Segments::TCS.new
|
|
79
|
+
|
|
80
|
+
seg.Field2 = 'Comp1Field2'
|
|
81
|
+
|
|
82
|
+
assert_equal 'TCS*:Comp1Field2~', seg.to_s
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_compound_segment_assign_values_with_same_field_names
|
|
86
|
+
|
|
87
|
+
seg = Hippo_eyeDoc::Segments::TCS.new
|
|
88
|
+
|
|
89
|
+
seg.CompositeCommonName = 'CompVal1'
|
|
90
|
+
seg.CompositeCommonName_02 = 'CompVal2'
|
|
91
|
+
|
|
92
|
+
assert_equal 'TCS*:::CompVal1*:::CompVal2~', seg.to_s
|
|
93
|
+
|
|
94
|
+
seg.CompositeCommonName_1 = 'CompVal3'
|
|
95
|
+
seg.CompositeCommonName_2 = 'CompVal4'
|
|
96
|
+
|
|
97
|
+
assert_equal 'TCS*:::CompVal3*:::CompVal4~', seg.to_s
|
|
98
|
+
|
|
99
|
+
seg.TCS01_04 = 'CompVal5'
|
|
100
|
+
seg.TCS02_04 = 'CompVal6'
|
|
101
|
+
|
|
102
|
+
assert_equal 'TCS*:::CompVal5*:::CompVal6~', seg.to_s
|
|
103
|
+
|
|
104
|
+
assert_equal 'CompVal5', seg.TCS01_04
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def test_assign_invalid_field_throws_error
|
|
108
|
+
assert_raises(Hippo_eyeDoc::Exceptions::InvalidField) do
|
|
109
|
+
seg = Hippo_eyeDoc::Segments::NM1.new
|
|
110
|
+
seg.InvalidField = 'Error should be raised.'
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def test_raises_invalid_value_for_date_fields
|
|
115
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
116
|
+
|
|
117
|
+
assert_raises(Hippo_eyeDoc::Exceptions::InvalidValue) { seg.DateField = "asdf" }
|
|
118
|
+
assert_raises(Hippo_eyeDoc::Exceptions::InvalidValue) { seg.DateField = "0810" }
|
|
119
|
+
|
|
120
|
+
seg.DateField = Date.today
|
|
121
|
+
seg.DateField = "20120120"
|
|
122
|
+
seg.DateField = Time.now
|
|
123
|
+
seg.DateField = nil
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def test_raises_invalid_value_for_time_fields
|
|
127
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
128
|
+
|
|
129
|
+
assert_raises(Hippo_eyeDoc::Exceptions::InvalidValue) { seg.TimeField = "asdf" }
|
|
130
|
+
assert_raises(Hippo_eyeDoc::Exceptions::InvalidValue) { seg.TimeField = "25111201" }
|
|
131
|
+
assert_raises(Hippo_eyeDoc::Exceptions::InvalidValue) { seg.TimeField = Date.today }
|
|
132
|
+
|
|
133
|
+
seg.TimeField = "0120"
|
|
134
|
+
seg.TimeField = Time.now
|
|
135
|
+
seg.TimeField = nil
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def test_performs_type_conversion
|
|
139
|
+
seg = Hippo_eyeDoc::Segments::TSS.new
|
|
140
|
+
|
|
141
|
+
seg.DateField = '20120121'
|
|
142
|
+
assert_equal Date.new(2012,01,21), seg.DateField
|
|
143
|
+
|
|
144
|
+
seg.TimeField = '231101'
|
|
145
|
+
assert_equal Time.new(Date.today.year, Date.today.month, Date.today.day, 23,11,01), seg.TimeField
|
|
146
|
+
|
|
147
|
+
seg.IntegerField = '2'
|
|
148
|
+
assert_equal 2, seg.IntegerField
|
|
149
|
+
|
|
150
|
+
seg.DecimalField = '123.45'
|
|
151
|
+
assert_equal BigDecimal.new('123.45'), seg.DecimalField
|
|
152
|
+
|
|
153
|
+
assert_equal 'TSS*******20120121*231101*2*123.45~', seg.to_s
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def test_fixed_width_segment
|
|
157
|
+
isa = Hippo_eyeDoc::Segments::ISA.new
|
|
158
|
+
|
|
159
|
+
assert_equal "ISA* *#{' ' * 10}* *#{' ' * 10}* *#{' ' * 15}* *#{' ' * 15}*#{Date.today.strftime('%y%m%d')}*#{Time.now.strftime('%H%M')}* * *#{'0' * 9}* * * ~", isa.to_s
|
|
160
|
+
|
|
161
|
+
isa.AuthorizationInformationQualifier = '00'
|
|
162
|
+
isa.SecurityInformationQualifier = '00'
|
|
163
|
+
isa.InterchangeIdQualifier_01 = 'ZZ'
|
|
164
|
+
isa.InterchangeSenderId = '593208085'
|
|
165
|
+
isa.InterchangeIdQualifier_02 = 'ZZ'
|
|
166
|
+
isa.InterchangeReceiverId = 'OVERRIDE'
|
|
167
|
+
isa.InterchangeDate = Time.now
|
|
168
|
+
isa.InterchangeTime = Time.now
|
|
169
|
+
isa.RepetitionSeparator = Hippo_eyeDoc::DEFAULT_REPETITION_SEPARATOR
|
|
170
|
+
isa.InterchangeControlVersionNumber = '00501'
|
|
171
|
+
isa.InterchangeControlNumber = 12345
|
|
172
|
+
isa.AcknowledgmentRequested = '1'
|
|
173
|
+
isa.InterchangeUsageIndicator = 'T'
|
|
174
|
+
isa.ComponentElementSeparator = Hippo_eyeDoc::DEFAULT_COMPOSITE_SEPARATOR
|
|
175
|
+
|
|
176
|
+
assert_equal "ISA*00* *00* *ZZ*593208085 *ZZ*OVERRIDE *#{Date.today.strftime('%y%m%d')}*#{Time.now.strftime('%H%M')}*^*00501*000012345*1*T*:~", isa.to_s
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def test_access_empty_composite_returns_nil
|
|
180
|
+
seg = Hippo_eyeDoc::Segments::TCS.new
|
|
181
|
+
|
|
182
|
+
assert_equal nil, seg.TCS01_01
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def test_segment_parse_for_composite_fields
|
|
186
|
+
input_string = "STC*A7:755:87*20121127*U*2200******A3:448**REJECTED AT CLEARINGHOUSE PAY-TO PROVIDER PRIMARY ID# IS NOT USED (1235196510) (59141)"
|
|
187
|
+
seg = Hippo_eyeDoc::Segments::STC.new.parse(input_string)
|
|
188
|
+
assert_equal input_string + '~', seg.to_s
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def test_empty_fields_are_removed
|
|
192
|
+
n1 = Hippo_eyeDoc::Segments::N1.new.parse("N1*PE* *XX*1234567890")
|
|
193
|
+
assert_equal "N1*PE**XX*1234567890~", n1.to_s
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def test_remove_empty_fields_doesnt_change_populated_fields
|
|
197
|
+
original = "N1*PE*SOME RANDOM NAME HERE*XX*1234567890"
|
|
198
|
+
n1 = Hippo_eyeDoc::Segments::N1.new.parse(original)
|
|
199
|
+
assert_equal original + '~', n1.to_s
|
|
200
|
+
end
|
|
201
|
+
end
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
require File.expand_path('test_helper', File.dirname(__FILE__))
|
|
2
|
+
|
|
3
|
+
class TestTransactionSetBase < MiniTest::Unit::TestCase
|
|
4
|
+
def test_preset_values_are_set
|
|
5
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
6
|
+
ts.TCS
|
|
7
|
+
ts.TSS.build
|
|
8
|
+
|
|
9
|
+
assert_equal 'TSS*Blah~TCS***Preset Field 7~', ts.to_s
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_segment_ordering_is_correct
|
|
13
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
14
|
+
ts.TCS.Field1 = 'Foo'
|
|
15
|
+
ts.TSS.Field2 = 'Bar'
|
|
16
|
+
|
|
17
|
+
assert_equal 'TSS*Blah*Bar~TCS*Foo**Preset Field 7~', ts.to_s
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_raises_error_on_invalid_segment
|
|
21
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
22
|
+
assert_raises Hippo_eyeDoc::Exceptions::InvalidSegment do
|
|
23
|
+
ts.BLAH {|blah| }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_identified_by_values_are_set
|
|
28
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
29
|
+
ts.L0001 {|l0001| }
|
|
30
|
+
|
|
31
|
+
assert_equal 'TSS*Foo~', ts.to_s
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_accessing_segments_with_same_segment_id
|
|
35
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
36
|
+
ts.TSS.Field2 = 'Bar'
|
|
37
|
+
ts.TCS.Field1 = 'Foo'
|
|
38
|
+
ts.TSS_02.Field2 = 'Baz'
|
|
39
|
+
|
|
40
|
+
assert_equal 'TSS*Blah*Bar~TCS*Foo**Preset Field 7~TSS*Last Standalone Segment*Baz~', ts.to_s
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_accessing_segments_by_name
|
|
44
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
45
|
+
ts.find_by_name('Test Simple Segment #1') do |tss|
|
|
46
|
+
tss.Field2 = 'Baz'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
assert_equal 'TSS*Blah*Baz~', ts.to_s
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def test_accessing_segments_by_name_regexp
|
|
53
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
54
|
+
ts.find_by_name(/Segment/) do |tss|
|
|
55
|
+
tss.Field2 = 'Baz'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
assert_equal 'TSS*Blah*Baz~', ts.to_s
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_assigning_segment_values_with_block_syntax
|
|
62
|
+
ts = Hippo_eyeDoc::TransactionSets::Test::Base.new
|
|
63
|
+
|
|
64
|
+
ts.TSS do |tss|
|
|
65
|
+
tss.Field2 = 'Bar'
|
|
66
|
+
tss.Field3 = 'Baz'
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
ts.TCS do |tcs|
|
|
70
|
+
tcs.Field1 = 'Blah'
|
|
71
|
+
tcs.CompositeCommonName_02 = 'CNBlah'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
ts.TSS_02 do |tss|
|
|
75
|
+
tss.Field2 = 'Boo'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
assert_equal 'TSS*Blah*Bar*Baz~TCS*Blah*:::CNBlah*Preset Field 7~TSS*Last Standalone Segment*Boo~', ts.to_s
|
|
79
|
+
|
|
80
|
+
# test nexted block syntax on non-looping component
|
|
81
|
+
ts.L0001 do |l0001|
|
|
82
|
+
l0001.TSS do |tss|
|
|
83
|
+
tss.Field2 = 'SubBar'
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
assert_equal 'TSS*Blah*Bar*Baz~TCS*Blah*:::CNBlah*Preset Field 7~TSS*Last Standalone Segment*Boo~TSS*Foo*SubBar~', ts.to_s
|
|
88
|
+
|
|
89
|
+
# test nexted block syntax on non-looping component
|
|
90
|
+
ts.L0002 do |l0002|
|
|
91
|
+
l0002.TCS do |tcs|
|
|
92
|
+
tcs.Field2 = 'SubBarBlah'
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
l0002.TSS do |tss|
|
|
96
|
+
tss.Field2 = 'SubBarRepeater'
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
assert_equal 'TSS*Blah*Bar*Baz~TCS*Blah*:::CNBlah*Preset Field 7~TSS*Last Standalone Segment*Boo~TSS*Foo*SubBar~TCS*:SubBarBlah**Foo2~TSS*Last Segment*SubBarRepeater~', ts.to_s
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def test_intializing_with_segment_array_populates_transaction_set
|
|
104
|
+
tss = Hippo_eyeDoc::Segments::TSS.new
|
|
105
|
+
tss.TSS01 = 'Blah'
|
|
106
|
+
|
|
107
|
+
tcs = Hippo_eyeDoc::Segments::TCS.new
|
|
108
|
+
tcs.Field7 = 'Preset Field 7'
|
|
109
|
+
|
|
110
|
+
tss2 = Hippo_eyeDoc::Segments::TSS.new
|
|
111
|
+
tss2.TSS01 = 'Last Standalone Segment'
|
|
112
|
+
|
|
113
|
+
# start L0001 segments
|
|
114
|
+
tss3 = Hippo_eyeDoc::Segments::TSS.new
|
|
115
|
+
tss3.TSS01 = 'Foo'
|
|
116
|
+
|
|
117
|
+
segment_array = [tss, tcs, tss2, tss3]
|
|
118
|
+
|
|
119
|
+
assert_equal segment_array.map(&:to_s).join, Hippo_eyeDoc::TransactionSets::Test::Base.new(:segments => segment_array).to_s
|
|
120
|
+
assert_empty segment_array
|
|
121
|
+
end
|
|
122
|
+
end
|