sandozxmlconv 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env ruby
2
+ # Integration::TestProPharmaI2 -- xmlconv2 -- 17.09.2007 -- hwyss@ywesee.com
3
+
4
+ $: << File.expand_path('..', File.dirname(__FILE__))
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/util/transaction'
9
+ require 'xmlconv/util/destination'
10
+ require 'conversion/propharma_bdd'
11
+ require 'conversion/bdd_csv'
12
+
13
+ module XmlConv
14
+ module Integration
15
+ class TestProPharmaI2 < Test::Unit::TestCase
16
+ def setup
17
+ @target_dir = File.expand_path('data/propharma_csv',
18
+ File.dirname(__FILE__))
19
+ clear_dir
20
+ end
21
+ def teardown
22
+ clear_dir
23
+ end
24
+ def clear_dir
25
+ if(File.exist?(@target_dir))
26
+ FileUtils.rm_r(@target_dir)
27
+ end
28
+ end
29
+ def test_propharma_csv
30
+ XmlConv::CONFIG.default_filename = '%s%s_%s.txt'
31
+ src = <<-EOS
32
+ [KUNDE]
33
+ idt=4100606423
34
+ nam=Heimstaette Baerau
35
+ ort=3552 B„rau
36
+ [BSTELL]
37
+ ref=103492
38
+ dat=A80213
39
+ tim=1353
40
+ [ARTIK]
41
+ typ=P
42
+ phc=02839238
43
+ art=CARSOL CR TABL 200 MG 200 STK
44
+ mge=2
45
+ [ARTIK]
46
+ typ=P
47
+ phc=02839296
48
+ art=CARSOL CR TABL 400 MG 200 STK
49
+ mge=5
50
+ [ARTIK]
51
+ typ=P
52
+ phc=02550609
53
+ art=CITALOPRAM ECOSOL FILMTABL 40 MG 100 STK
54
+ mge=1
55
+ [ARTIK]
56
+ typ=P
57
+ phc=02940977
58
+ art=ECODOLOR RET TABL 100 MG 50 STK
59
+ mge=10
60
+ [ARTIK]
61
+ typ=P
62
+ phc=01301850
63
+ art=ECODUREX TABL 5/50 100 STK
64
+ mge=3
65
+ [ARTIK]
66
+ typ=P
67
+ phc=02128827
68
+ art=ECOFENAC LIPOGEL 1 % 100 G
69
+ mge=50
70
+ [ARTIK]
71
+ typ=P
72
+ phc=02128773
73
+ art=NORSOL TABL 400 MG 42 STK
74
+ mge=2
75
+ [ARTIK]
76
+ typ=P
77
+ phc=02919753
78
+ art=OMED TAB FILMTABL 20 MG 100 STK
79
+ mge=20
80
+ [ARTIK]
81
+ typ=P
82
+ phc=03463433
83
+ art=OMEPRAZOL SANDOZ ECO KAPS 40 MG 56 STK
84
+ mge=20
85
+ [ARTIK]
86
+ typ=P
87
+ phc=02965635
88
+ art=PRAVASTA ECO TABL 20 MG 100 STK
89
+ mge=3
90
+ [ARTIK]
91
+ typ=P
92
+ phc=02965730
93
+ art=TORASIS TABL 5 MG 100 STK
94
+ mge=10
95
+ [ARTIK]
96
+ typ=P
97
+ phc=03663623
98
+ art=METO ZEROK RET TABL 25 MG 100 STK
99
+ mge=1
100
+ EOS
101
+ ast = Conversion::ProPharmaBdd.parse(src)
102
+ bdd = Conversion::ProPharmaBdd.convert(ast)
103
+ csv_docs = Conversion::BddCsv.convert(bdd)
104
+ assert_instance_of(Array, csv_docs)
105
+ csv_doc = csv_docs.first
106
+ assert_match(/^4100606423_.*\.txt/, csv_doc.filename)
107
+ result = csv_doc.to_s.split("\n")
108
+ dstr = Date.today.strftime("%d%m%Y")
109
+ expected = <<-EOS
110
+ 4100606423,,#{dstr},,02839238,,,2,,103492,
111
+ 4100606423,,#{dstr},,02839296,,,5,,103492,
112
+ 4100606423,,#{dstr},,02550609,,,1,,103492,
113
+ 4100606423,,#{dstr},,02940977,,,10,,103492,
114
+ 4100606423,,#{dstr},,01301850,,,3,,103492,
115
+ 4100606423,,#{dstr},,02128827,,,50,,103492,
116
+ 4100606423,,#{dstr},,02128773,,,2,,103492,
117
+ 4100606423,,#{dstr},,02919753,,,20,,103492,
118
+ 4100606423,,#{dstr},,03463433,,,20,,103492,
119
+ 4100606423,,#{dstr},,02965635,,,3,,103492,
120
+ 4100606423,,#{dstr},,02965730,,,10,,103492,
121
+ 4100606423,,#{dstr},,03663623,,,1,,103492,
122
+ EOS
123
+ expected.split("\n").each_with_index { |line, index|
124
+ assert_equal(line, result[index])
125
+ }
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+ # TestPharmaciePlusI2 -- xmlconv2 -- 21.08.2006 -- hwyss@ywesee.com
3
+
4
+ $: << File.expand_path('..', File.dirname(__FILE__))
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/util/transaction'
9
+ require 'xmlconv/util/destination'
10
+ require 'conversion/sunstore_bdd'
11
+ require 'conversion/bdd_csv'
12
+
13
+ module XmlConv
14
+ module Integration
15
+ class TestXmlI2 < Test::Unit::TestCase
16
+ def setup
17
+ @src = <<-XML
18
+ <?xml version="1.0" encoding="ISO-8859-1"?>
19
+ <customerOrder xmlns="http://www.e-galexis.com/schemas/"
20
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21
+ xsi:schemaLocation="http://www.e-galexis.com/schemas/ http://www.e-galexis.com/schemas/POS/customerOrder/customerOrder.xsd"
22
+ backLogDesired="true" compressionDesired="false" language="de"
23
+ productDescriptionDesired="false" roundUpForCondition="true"
24
+ version="1.0">
25
+ <client number="test" password="test" />
26
+ <orderHeader deliveryDate="2002-08-25"
27
+ referenceNumber="123ABCDE9012345" mannerOfTransport="tour"
28
+ urgent="false">
29
+ <deliveryAddress line1="Superkunde" line4="Linkestrasse 99"
30
+ line5PostalCode="3322" line5City="Sch&#246;nb&#252;hl">
31
+ <addressLine2And3Text line2="Dorfladen" line3="Frau Muster" />
32
+ </deliveryAddress>
33
+ </orderHeader>
34
+ <orderLines>
35
+ <productOrderLine orderQuantity="10" roundUpForCondition="true"
36
+ backLogDesired="false">
37
+ <pharmaCode id="1336630" />
38
+ </productOrderLine>
39
+ <productLabelOrderLine defaultOrderQuantity="5">
40
+ <EAN id="7680123456789" />
41
+ <supplierProductNumber EANsupplierId="54321678091432"
42
+ id="123.234-2" />
43
+ </productLabelOrderLine>
44
+ </orderLines>
45
+ </customerOrder>
46
+ XML
47
+ @xml_doc = REXML::Document.new(@src)
48
+ @target_dir = File.expand_path('data/pharmacieplus_csv',
49
+ File.dirname(__FILE__))
50
+ clear_dir
51
+ end
52
+ def teardown
53
+ clear_dir
54
+ end
55
+ def clear_dir
56
+ if(File.exist?(@target_dir))
57
+ FileUtils.rm_r(@target_dir)
58
+ end
59
+ end
60
+ def test_pharmacieplus_csv
61
+ XmlConv::CONFIG.default_filename = "%s%s_%s.txt"
62
+ bdd = Conversion::SunStoreBdd.convert(@xml_doc)
63
+ csv_docs = Conversion::BddCsv.convert(bdd)
64
+ assert_instance_of(Array, csv_docs)
65
+ csv_doc = csv_docs.first
66
+ assert_match(/^test_.*\.txt/, csv_doc.filename)
67
+ result = csv_doc.to_s.split("\n")
68
+ dstr = Date.today.strftime("%d%m%Y")
69
+ expected = <<-EOS
70
+ ,test,#{dstr},,1336630,,,10,,123ABCDE9012345,
71
+ ,test,#{dstr},,,7680123456789,,5,,123ABCDE9012345,
72
+ EOS
73
+ expected.split("\n").each_with_index { |line, index|
74
+ assert_equal(line, result[index])
75
+ }
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+ # TestPharmaciePlusI2 -- xmlconv2 -- 21.08.2006 -- hwyss@ywesee.com
3
+
4
+ $: << File.expand_path('..', File.dirname(__FILE__))
5
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
6
+
7
+ require 'test/unit'
8
+ require 'xmlconv/util/transaction'
9
+ require 'xmlconv/util/destination'
10
+ require 'conversion/xundart_bdd'
11
+ require 'conversion/bdd_csv'
12
+
13
+ module XmlConv
14
+ module Integration
15
+ class TestXmlI2 < Test::Unit::TestCase
16
+ def setup
17
+ @src = <<-XML
18
+ <?xml version="1.0" encoding="iso-8859-1"?>
19
+ <commande xmlns="http://www.xundart.ch" date="7/2/2009 5:29:52 PM" id="1234">
20
+ <com-pharma ean="7601010273543">
21
+ <livraison><last-name>Dr. med. Xxxxx Xxxxxx</last-name><address><street>Xxxxxxxxxxxxxxxxx 19</street><zip>9524</zip><city>Zuzwil</city></address></livraison>
22
+ <article ean="7680568730217" pharmacode="3938385" qte_facture="19"><desc>Torasemid Sandoz eco Tabl 2.5 mg 20 Stk</desc></article>
23
+ <article ean="7680569080175" pharmacode="3729807" qte_facture="2"><desc>Omeprazol Sandoz eco Filmtabl/Stechamp Filmtabl 20 mg 56 Stk</desc></article>
24
+ <article ean="7680162790136" pharmacode="0384673" qte_facture="3"><desc>Calcium Sandoz Ampullen 90 mg 10% 5x10 ml Ampullen</desc></article></com-pharma>
25
+
26
+ <com-pharma ean="7601010273963">
27
+ <livraison><last-name>Dr. med. Xxxxxxxxx Xxxxxxx</last-name><address><street>Xxxxxxxxxxxxx 3</street><zip>9602</zip><city>Bazenheid</city></address></livraison>
28
+ <article ean="7680560350208" pharmacode="3275944" qte_facture="3"><desc>Simcora Filmtabl 60 mg 100 Stk</desc></article></com-pharma>
29
+
30
+ <com-pharma ean="7601000000000">
31
+ <livraison><last-name> Max Muster</last-name><address><street>St. Jakob-Strasse 56a</street><zip>9000</zip><city>St. Gallen</city></address></livraison>
32
+ <article ean="7680562030047" pharmacode="3296509" qte_facture="5"><desc>Amoxicillin Sandoz Disp Tabl 1000 mg 20 Tabl</desc></article>
33
+ <article ean="7680162790136" pharmacode="0384673" qte_facture="1"><desc>Calcium Sandoz Ampullen 90 mg 10% 5x10 ml Ampullen</desc></article>
34
+ <article ean="7680562030184" pharmacode="3401484" qte_facture="10"><desc>Amoxicillin Sandoz Disp Tabl 750 mg 20 Tabl</desc></article></com-pharma>
35
+ </commande>
36
+ XML
37
+ @xml_doc = REXML::Document.new(@src)
38
+ @target_dir = File.expand_path('data/pharmacieplus_csv',
39
+ File.dirname(__FILE__))
40
+ clear_dir
41
+ end
42
+ def teardown
43
+ clear_dir
44
+ end
45
+ def clear_dir
46
+ if(File.exist?(@target_dir))
47
+ FileUtils.rm_r(@target_dir)
48
+ end
49
+ end
50
+ def test_pharmacieplus_csv
51
+ XmlConv::CONFIG.default_filename = "%s%s_%s.txt"
52
+ bdd = Conversion::PharmaciePlusBdd.convert(@xml_doc)
53
+ csv_docs = Conversion::BddCsv.convert(bdd)
54
+ assert_instance_of(Array, csv_docs)
55
+ csv_doc = csv_docs.first
56
+ assert_match(/^7601010273543_.*\.txt/, csv_doc.filename)
57
+ result = csv_doc.to_s.split("\n")
58
+ dstr = Date.today.strftime("%d%m%Y")
59
+ expected = <<-EOS
60
+ ,7601010273543,#{dstr},,3938385,7680568730217,,"",,1234,
61
+ ,7601010273543,#{dstr},,3729807,7680569080175,,"",,1234,
62
+ ,7601010273543,#{dstr},,0384673,7680162790136,,"",,1234,
63
+ EOS
64
+
65
+ expected.split("\n").each_with_index { |line, index|
66
+ assert_equal(line, result[index])
67
+ }
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,229 @@
1
+ #!/usr/bin/env ruby
2
+ # PostProcess::TestBbmb -- xmlconv2 -- 25.08.2006 -- hwyss@ywesee.com
3
+
4
+ $: << File.expand_path('../../lib', File.dirname(__FILE__))
5
+
6
+ require 'test/unit'
7
+ require 'postprocess/bbmb'
8
+ require 'flexmock'
9
+ require 'conversion/pharmacieplus_bdd'
10
+
11
+ module XmlConv
12
+ module PostProcess
13
+ class TestBbmb < Test::Unit::TestCase
14
+ def test_inject
15
+ src = <<-XML
16
+ <?xml version="1.0" encoding="ISO-8859-1"?>
17
+ <commande id="1861" date="2006-08-16T09:32:35.303+02:00" xmlns="http://www.ofac.ch/XEDO">
18
+ <groupe>
19
+ <last-name>pharmacieplus Directe</last-name>
20
+ <first-name> </first-name>
21
+ <other-name>Messieurs Eric Bussat + Christian Rouvinez</other-name>
22
+ <address>
23
+ <street>les courbes 5</street>
24
+ <zip>1121</zip>
25
+ <city>Bremblens</city>
26
+ </address>
27
+ <telecom>
28
+ <phone number="021 811 48 88"/>
29
+ <fax number="021 811 48 89"/>
30
+ </telecom>
31
+ <online>
32
+ <email>secretariat@pharmacieplus.ch</email>
33
+ </online>
34
+ </groupe>
35
+ <fournisseur ean="7601001000681">
36
+ <last-name>GLOBOPHARM AG</last-name>
37
+ <first-name> </first-name>
38
+ <address>
39
+ <street>Seestrasse 200</street>
40
+ <zip>8700</zip>
41
+ <city>KUESNACHT</city>
42
+ <country>CH</country>
43
+ </address>
44
+ </fournisseur>
45
+ <com-global>
46
+ <article ean="7680543802083" pharmacode="2054106" qte-livraison="12" qte-facture="10">
47
+ <desc>ANTRA MUPS 10 Tabl 10 mg 100 Stk</desc>
48
+ <cond-com>
49
+ <bonus facture="10" livre="12"/>
50
+ </cond-com>
51
+ </article>
52
+ <article ean="7680543800386" pharmacode="2054081" qte-livraison="12" qte-facture="10">
53
+ <desc>ANTRA MUPS 10 Tabl 10 mg 28 Stk</desc>
54
+ <cond-com>
55
+ <bonus facture="10" livre="12"/>
56
+ </cond-com>
57
+ </article>
58
+ <article ean="7680543801949" pharmacode="2054098" qte-livraison="30" qte-facture="20">
59
+ <desc>ANTRA MUPS 10 Tabl 10 mg 56 Stk</desc>
60
+ <cond-com>
61
+ <bonus facture="10" livre="15"/>
62
+ </cond-com>
63
+ </article>
64
+ <article ean="7680543802403" pharmacode="2054158" qte-livraison="15" qte-facture="10">
65
+ <desc>ANTRA MUPS 20 Tabl 20 mg 100 Stk</desc>
66
+ <cond-com>
67
+ <bonus facture="10" livre="15"/>
68
+ </cond-com>
69
+ </article>
70
+ <article ean="7680543800898" pharmacode="2054129" qte-livraison="13" qte-facture="13">
71
+ <desc>ANTRA MUPS 20 Tabl 20 mg 14 Stk</desc>
72
+ <cond-com rabais="10.0"/>
73
+ </article>
74
+ <article ean="7680543800973" pharmacode="2054135" qte-livraison="28" qte-facture="20">
75
+ <desc>ANTRA MUPS 20 Tabl 20 mg 28 Stk</desc>
76
+ <cond-com>
77
+ <bonus facture="10" livre="14"/>
78
+ </cond-com>
79
+ </article>
80
+ <article ean="7680543802328" pharmacode="2054141" qte-livraison="17" qte-facture="17">
81
+ <desc>ANTRA MUPS 20 Tabl 20 mg 56 Stk</desc>
82
+ <cond-com rabais="15.0"/>
83
+ </article>
84
+ <article ean="7680543800706" pharmacode="2054112" qte-livraison="28" qte-facture="20">
85
+ <desc>ANTRA MUPS 20 Tabl 20 mg 7 Stk</desc>
86
+ <cond-com>
87
+ <bonus facture="10" livre="14"/>
88
+ </cond-com>
89
+ </article>
90
+ <article ean="7680548750532" pharmacode="2204899" qte-livraison="11" qte-facture="11">
91
+ <desc>ATACAND PLUS Tabl 16/12.5 mg 28 Stk</desc>
92
+ <cond-com rabais="5.0"/>
93
+ </article>
94
+ <article ean="7680548750617" pharmacode="2204907" qte-livraison="30" qte-facture="20">
95
+ <desc>ATACAND PLUS Tabl 16/12.5 mg 98 Stk</desc>
96
+ <cond-com>
97
+ <bonus facture="10" livre="15"/>
98
+ </cond-com>
99
+ </article>
100
+ </com-global>
101
+ <com-pharma ean="7601001368095">
102
+ <livraison>
103
+ <last-name>Pharmacie du Mandement</last-name>
104
+ <first-name> </first-name>
105
+ <other-name> Monsieur Fr�d�ric Recipient </other-name>
106
+ <address>
107
+ <street>3e adresse e-mail</street>
108
+ <zip>1242</zip>
109
+ <city>Satigny</city>
110
+ </address>
111
+ </livraison>
112
+ <article ean="7680543801949" pharmacode="2054098" qte-livraison="15" qte-facture="10">
113
+ <desc>ANTRA MUPS 10 Tabl 10 mg 56 Stk</desc>
114
+ </article>
115
+ <article ean="7680543802403" pharmacode="2054158" qte-livraison="15" qte-facture="10">
116
+ <desc>ANTRA MUPS 20 Tabl 20 mg 100 Stk</desc>
117
+ </article>
118
+ <article ean="7680543800898" pharmacode="2054129" qte-livraison="6" qte-facture="6">
119
+ <desc>ANTRA MUPS 20 Tabl 20 mg 14 Stk</desc>
120
+ </article>
121
+ <article ean="7680543802328" pharmacode="2054141" qte-livraison="9" qte-facture="9">
122
+ <desc>ANTRA MUPS 20 Tabl 20 mg 56 Stk</desc>
123
+ </article>
124
+ <article ean="7680543800706" pharmacode="2054112" qte-livraison="28" qte-facture="20">
125
+ <desc>ANTRA MUPS 20 Tabl 20 mg 7 Stk</desc>
126
+ </article>
127
+ <article ean="7680548750532" pharmacode="2204899" qte-livraison="11" qte-facture="11">
128
+ <desc>ATACAND PLUS Tabl 16/12.5 mg 28 Stk</desc>
129
+ </article>
130
+ <article ean="7680548750617" pharmacode="2204907" qte-livraison="30" qte-facture="20">
131
+ <desc>ATACAND PLUS Tabl 16/12.5 mg 98 Stk</desc>
132
+ </article>
133
+ </com-pharma>
134
+ <com-pharma ean="7601001368491">
135
+ <livraison>
136
+ <last-name>Pharm. Ecole-de-M�decine</last-name>
137
+ <first-name> </first-name>
138
+ <other-name> Madame Fran�oise Recipient </other-name>
139
+ <address>
140
+ <street>3e adresse e-mail</street>
141
+ <zip>1205</zip>
142
+ <city>Gen�ve</city>
143
+ </address>
144
+ </livraison>
145
+ <article ean="7680543802083" pharmacode="2054106" qte-livraison="12" qte-facture="10">
146
+ <desc>ANTRA MUPS 10 Tabl 10 mg 100 Stk</desc>
147
+ </article>
148
+ <article ean="7680543800386" pharmacode="2054081" qte-livraison="12" qte-facture="10">
149
+ <desc>ANTRA MUPS 10 Tabl 10 mg 28 Stk</desc>
150
+ </article>
151
+ <article ean="7680543801949" pharmacode="2054098" qte-livraison="15" qte-facture="10">
152
+ <desc>ANTRA MUPS 10 Tabl 10 mg 56 Stk</desc>
153
+ </article>
154
+ <article ean="7680543800898" pharmacode="2054129" qte-livraison="7" qte-facture="7">
155
+ <desc>ANTRA MUPS 20 Tabl 20 mg 14 Stk</desc>
156
+ </article>
157
+ <article ean="7680543800973" pharmacode="2054135" qte-livraison="28" qte-facture="20">
158
+ <desc>ANTRA MUPS 20 Tabl 20 mg 28 Stk</desc>
159
+ </article>
160
+ <article ean="7680543802328" pharmacode="2054141" qte-livraison="8" qte-facture="8">
161
+ <desc>ANTRA MUPS 20 Tabl 20 mg 56 Stk</desc>
162
+ </article>
163
+ </com-pharma>
164
+ </commande>
165
+ XML
166
+ xml_doc = REXML::Document.new(src)
167
+ bdd = Conversion::PharmaciePlusBdd.convert(xml_doc)
168
+ transaction = FlexMock.new
169
+ transaction.should_receive(:model).and_return { bdd }
170
+ bbmb = FlexMock.new
171
+ expected_orders = [
172
+ [
173
+ [{:article_ean13=>"7680543801949", :article_pcode=>"2054098"}, 15],
174
+ [{:article_ean13=>"7680543802403", :article_pcode=>"2054158"}, 15],
175
+ [{:article_ean13=>"7680543800898", :article_pcode=>"2054129"}, 6],
176
+ [{:article_ean13=>"7680543802328", :article_pcode=>"2054141"}, 9],
177
+ [{:article_ean13=>"7680543800706", :article_pcode=>"2054112"}, 28],
178
+ [{:article_ean13=>"7680548750532", :article_pcode=>"2204899"}, 11],
179
+ [{:article_ean13=>"7680548750617", :article_pcode=>"2204907"}, 30],
180
+ ],
181
+ [
182
+ [{:article_ean13=>"7680543802083", :article_pcode=>"2054106"}, 12],
183
+ [{:article_ean13=>"7680543800386", :article_pcode=>"2054081"}, 12],
184
+ [{:article_ean13=>"7680543801949", :article_pcode=>"2054098"}, 15],
185
+ [{:article_ean13=>"7680543800898", :article_pcode=>"2054129"}, 7],
186
+ [{:article_ean13=>"7680543800973", :article_pcode=>"2054135"}, 28],
187
+ [{:article_ean13=>"7680543802328", :article_pcode=>"2054141"}, 8],
188
+ ],
189
+ ]
190
+ expected_infos = [
191
+ {
192
+ :order_reference => "1861",
193
+ :order_comment => <<-EOS.strip
194
+ 7601001368095
195
+ Monsieur Fr�d�ric Recipient
196
+ Pharmacie du Mandement
197
+ 3e adresse e-mail
198
+ 1242 Satigny
199
+ EOS
200
+ },
201
+ {
202
+ :order_reference => "1861",
203
+ :order_comment => <<-EOS.strip
204
+ 7601001368491
205
+ Madame Fran�oise Recipient
206
+ Pharm. Ecole-de-M�decine
207
+ 3e adresse e-mail
208
+ 1205 Gen�ve
209
+ EOS
210
+ },
211
+ ]
212
+ bbmb.should_receive(:inject_order).times(2)\
213
+ .and_return { |short, id, order, info|
214
+ assert_equal('gag', short)
215
+ assert_equal('221200', id)
216
+ assert_equal(expected_orders.shift, order)
217
+ assert_equal(expected_infos.shift, info)
218
+ raise "some error"
219
+ }
220
+ svc = DRb.start_service('druby://localhost:0', bbmb)
221
+ assert_raises(RuntimeError) {
222
+ Bbmb.inject(svc.uri, 'gag', '221200', transaction)
223
+ }
224
+ ensure
225
+ svc.stop_service
226
+ end
227
+ end
228
+ end
229
+ end