medivo 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/app/assets/javascripts/medivo/lab_appointment/handlers.coffee +25 -20
  2. data/app/models/medivo/lab.rb +3 -2
  3. data/app/models/medivo/order.rb +3 -3
  4. data/lib/medivo/version.rb +1 -1
  5. data/spec/controllers/orders_controller_spec.rb +2 -2
  6. data/spec/dummy/log/development.log +583 -0
  7. data/spec/dummy/log/test.log +232 -0
  8. data/spec/dummy/tmp/cache/assets/C46/F00/sprockets%2F2281d588b540056c5a7306c32a3761b9 +0 -0
  9. data/spec/dummy/tmp/cache/assets/C6C/8D0/sprockets%2F2f423a28516973330a94ad121151f3bf +0 -0
  10. data/spec/dummy/tmp/cache/assets/C81/D00/sprockets%2F64f056bd752d271308a86a6f865b1911 +0 -0
  11. data/spec/dummy/tmp/cache/assets/CB4/BD0/sprockets%2F3378f27c0d4f5e6d708665b22707a31f +0 -0
  12. data/spec/dummy/tmp/cache/assets/CC3/EF0/sprockets%2F453b504c1f8f374578636f699eaa455d +0 -0
  13. data/spec/dummy/tmp/cache/assets/CD8/DA0/sprockets%2F622aa5281d15503829a5f7a0bf56fc29 +0 -0
  14. data/spec/dummy/tmp/cache/assets/CDD/820/sprockets%2Fb28231960c7ac62eff9048e702a29c70 +0 -0
  15. data/spec/dummy/tmp/cache/assets/CEC/EF0/sprockets%2F4b24a74018f693c06088bd52f8cc9f86 +0 -0
  16. data/spec/dummy/tmp/cache/assets/CEE/250/sprockets%2F96688f33f2f8aa261bf6701c1d6d7575 +0 -0
  17. data/spec/dummy/tmp/cache/assets/D07/6B0/sprockets%2F69a2df619ff14da071309dac4196400e +0 -0
  18. data/spec/dummy/tmp/cache/assets/D1B/820/sprockets%2F92a83e15913997b3d9ac7ed437b1e44c +0 -0
  19. data/spec/dummy/tmp/cache/assets/D20/F10/sprockets%2Fb2e907e4faa85fe755f4439e3b229088 +0 -0
  20. data/spec/dummy/tmp/cache/assets/D29/000/sprockets%2F61a10ddf57f1129c02a1049bfed6e007 +0 -0
  21. data/spec/dummy/tmp/cache/assets/D2C/F80/sprockets%2F399f6d5eb273936af7ff8f35a77c5037 +0 -0
  22. data/spec/dummy/tmp/cache/assets/D30/920/sprockets%2Fcc4603fc6441ca421a7d02886a81ab9d +0 -0
  23. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  24. data/spec/dummy/tmp/cache/assets/D36/870/sprockets%2Fce9e887568de873b133ae43d7c977f68 +0 -0
  25. data/spec/dummy/tmp/cache/assets/D41/250/sprockets%2F7b3c4426715dcd1feedc4a95e5444256 +0 -0
  26. data/spec/dummy/tmp/cache/assets/D45/320/sprockets%2Fc50ff379a1bdf1dd4d22249058749cf6 +0 -0
  27. data/spec/dummy/tmp/cache/assets/D4C/7A0/sprockets%2Fbc635c7b186d1ef5178f4ed3722d868b +0 -0
  28. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  29. data/spec/dummy/tmp/cache/assets/D55/ED0/sprockets%2F0f673e42e816c6fe5b66a5c96f896f1a +0 -0
  30. data/spec/dummy/tmp/cache/assets/D5D/3E0/sprockets%2F63fea6cc142b5f02da93bf81e70b2116 +0 -0
  31. data/spec/dummy/tmp/cache/assets/D60/030/sprockets%2Ffc9485f617fc5e9b8918755d2e08ecc6 +0 -0
  32. data/spec/dummy/tmp/cache/assets/D64/C50/sprockets%2F22ee6fb2ab1ea9694ac7f0f41a406094 +0 -0
  33. data/spec/dummy/tmp/cache/assets/D65/6D0/sprockets%2F3ce07ca1958d7ab3e80c4b3e0d24088c +0 -0
  34. data/spec/dummy/tmp/cache/assets/D69/130/sprockets%2Fbaa4ec50a34ce938c986612c2a47a64e +0 -0
  35. data/spec/dummy/tmp/cache/assets/D74/9A0/sprockets%2F0ca4e6e833c72156fc7e7d5f007d9ce3 +0 -0
  36. data/spec/dummy/tmp/cache/assets/D76/720/sprockets%2F88d8aa1d2fb41ce79b8ec4150ea74748 +0 -0
  37. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  38. data/spec/dummy/tmp/cache/assets/D88/2C0/sprockets%2F452ab3ebb1912cf1c2ba617eec52a718 +0 -0
  39. data/spec/dummy/tmp/cache/assets/D9C/F50/sprockets%2F224e78bb9e1c414a2d518a3aaffd6f77 +0 -0
  40. data/spec/dummy/tmp/cache/assets/D9F/260/sprockets%2Fa3e040f83c30e4bbc1c79ffae57909e6 +0 -0
  41. data/spec/dummy/tmp/cache/assets/DA1/640/sprockets%2F91874cbba5e63cd19d6a7bd3c8362dc4 +0 -0
  42. data/spec/dummy/tmp/cache/assets/DC1/230/sprockets%2F3a36cd467bdce1914a2b7af4ed4114cf +0 -0
  43. data/spec/dummy/tmp/cache/assets/DCE/E80/sprockets%2Fc71ec62157b9cc7aabfc030955cef87b +0 -0
  44. data/spec/dummy/tmp/cache/assets/DD1/FD0/sprockets%2Fa531f33dc9c5852d39d64a9eda44dacf +0 -0
  45. data/spec/dummy/tmp/cache/assets/DD4/2B0/sprockets%2Fef214a63f29afe7f3cbffc65af943108 +0 -0
  46. data/spec/dummy/tmp/cache/assets/DFC/420/sprockets%2F502e2c683d1aaad6ac88966ffc4d2ade +0 -0
  47. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  48. data/spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4 +0 -0
  49. data/spec/dummy/tmp/pids/server.pid +1 -0
  50. data/spec/fixtures/{Southeast.jpg → images/southeast.jpg} +0 -0
  51. data/spec/fixtures/{hepc_negative_results.pdf → pdfs/hepc_negative_results.pdf} +0 -0
  52. data/spec/fixtures/{hepc_result_faq.pdf → pdfs/hepc_result_faq.pdf} +0 -0
  53. data/spec/fixtures/{uhc_requisition_cover_letter.pdf → pdfs/uhc_requisition_cover_letter.pdf} +0 -0
  54. data/spec/fixtures/{uhc_result_cover_letter.pdf → pdfs/uhc_result_cover_letter.pdf} +0 -0
  55. data/spec/fixtures/{lc_order_with_normal_results.xml → xml/lc_order_with_normal_results.xml} +0 -0
  56. data/spec/fixtures/{lc_order_with_positive_results.xml → xml/lc_order_with_positive_results.xml} +0 -0
  57. data/spec/fixtures/{lc_order_with_requisition.xml → xml/lc_order_with_requisition.xml} +0 -0
  58. data/spec/fixtures/{valid_uhc_order.xml → xml/valid_uhc_order.xml} +0 -0
  59. data/spec/lib/fdf_generator_spec.rb +1 -1
  60. data/spec/lib/pdf_generator_spec.rb +4 -4
  61. data/spec/lib/pdf_group_spec.rb +10 -10
  62. data/spec/models/lab_test_order_spec.rb +2 -2
  63. data/spec/models/orders_spec.rb +38 -4
  64. data/spec/support/helper.rb +12 -0
  65. data/spec/support/sample_data.rb +3 -3
  66. metadata +39 -37
@@ -9,13 +9,13 @@ describe LabTestOrder do
9
9
  end
10
10
 
11
11
  it "#pdf_requisition" do
12
- stub_order_requisition(@requisition_id, medivo_fixture_path("lc_order_with_requisition.xml"))
12
+ stub_order_requisition(@requisition_id, medivo_xml_fixture_path("lc_order_with_requisition.xml"))
13
13
  @lab_order.pdf_requisition.read.size.should > 30000
14
14
  @lab_order.pdf_requisition.close
15
15
  end
16
16
 
17
17
  it "#pdf_result" do
18
- stub_order_result(@requisition_id, medivo_fixture_path("lc_order_with_normal_results.xml"))
18
+ stub_order_result(@requisition_id, medivo_xml_fixture_path("lc_order_with_normal_results.xml"))
19
19
  @lab_order.pdf_result.read.size.should > 30000
20
20
  show_me_the_pdf(@lab_order.pdf_result.pdf, '/tmp/test4.pdf')
21
21
  @lab_order.pdf_result.close
@@ -12,7 +12,7 @@ describe Medivo::Order do
12
12
  it "requires proper gender" do
13
13
  order = Medivo::Order.new({:gender=>"dude"})
14
14
  order.valid?
15
- order.errors.messages[:gender].should include "is not included in the list"
15
+ order.errors.messages[:gender].should include "gender field must be Male or Female"
16
16
  end
17
17
 
18
18
  it "requires proper dob" do
@@ -74,6 +74,39 @@ describe Medivo::Order do
74
74
  order.valid?.should == true
75
75
  end
76
76
 
77
+ it "save failure returning status code 422 sets an error message instead of throwing exception" do
78
+ stub_request(:post, "http://test:test@test.medivo.com/customers.xml").
79
+ to_return(:body => '<errors><error>Invalid PSC location</error></errors>',
80
+ :status => 422)
81
+ order = Medivo::Order.new(
82
+ :first_name=>'dan',
83
+ :last_name=>'dude',
84
+ :email => "dude@dude.com",
85
+ :address=> "my house",
86
+ :city=> "dudeville",
87
+ :state=> "CA",
88
+ :zip=> "90210",
89
+ :dob=> "19801201",
90
+ :home_phone=> "4155551212",
91
+ :psc=> 11, # let's pretend this is invalid psc
92
+ :test_types=> "2020",
93
+ :account_number => "423",
94
+ :gender => "Male",
95
+ :dob => "19801201")
96
+
97
+ order.save.should == false
98
+ order.valid?.should == false
99
+ order.errors.messages.keys.should include :base
100
+ order.errors.messages[:base].should == ["Invalid PSC location"]
101
+
102
+ # fixing the problem .. it now saves and is valid
103
+ stub_request(:post, "http://test:test@test.medivo.com/customers.xml").
104
+ to_return(:status => 200)
105
+
106
+ order.save.should == true
107
+ order.valid?.should == true
108
+ end
109
+
77
110
 
78
111
  it "creates valid order" do
79
112
  order = Medivo::Order.new(
@@ -121,7 +154,7 @@ describe Medivo::Order do
121
154
  before(:each) do
122
155
  @requisition_id = 170420
123
156
  order = Medivo::Order.new(:requisition_number=> @requisition_id)
124
- stub_order_requisition(@requisition_id, medivo_fixture_path("lc_order_with_requisition.xml"))
157
+ stub_order_requisition(@requisition_id, medivo_xml_fixture_path("lc_order_with_requisition.xml"))
125
158
  end
126
159
 
127
160
  let(:order) { Medivo::Order.find_with_requisition(@requisition_id) }
@@ -153,7 +186,7 @@ describe Medivo::Order do
153
186
  before(:each) do
154
187
  @requisition_id = 170853
155
188
  order = Medivo::Order.new(:requisition_number=>@requisition_id)
156
- stub_order_result(@requisition_id, medivo_fixture_path("lc_order_with_positive_results.xml"))
189
+ stub_order_result(@requisition_id, medivo_xml_fixture_path("lc_order_with_positive_results.xml"))
157
190
  end
158
191
 
159
192
  let(:order) { Medivo::Order.find_with_results(@requisition_id) }
@@ -202,6 +235,7 @@ end
202
235
 
203
236
 
204
237
  describe "creating orders" do
238
+
205
239
  it "UHC Commercial insurance order" do
206
240
  insurance_info = Medivo::PrimaryInsurance.new(
207
241
  :relationship=>1,
@@ -231,7 +265,7 @@ describe "creating orders" do
231
265
 
232
266
 
233
267
  mock.proxy(order).to_xml({}) do |value|
234
- value.strip_space.should == File.read("#{ENGINE_PATH}/spec/fixtures/valid_uhc_order.xml").strip_space
268
+ value.strip_space.should == File.read("#{ENGINE_PATH}/spec/fixtures/xml/valid_uhc_order.xml").strip_space
235
269
  value
236
270
  end
237
271
 
@@ -39,6 +39,18 @@ module Medivo::Spec
39
39
  "#{FIXTURE_PATH}/#{file_name}"
40
40
  end
41
41
 
42
+ def medivo_pdf_fixture_path(file_name)
43
+ "#{FIXTURE_PATH}/pdfs/#{file_name}"
44
+ end
45
+
46
+ def medivo_img_fixture_path(file_name)
47
+ "#{FIXTURE_PATH}/images/#{file_name}"
48
+ end
49
+
50
+ def medivo_xml_fixture_path(file_name)
51
+ "#{FIXTURE_PATH}/xml/#{file_name}"
52
+ end
53
+
42
54
  ##
43
55
  # requisition_id Number id of the Medivo::Order you are stubbing
44
56
  # file_path String points to the path to xml file with order info which contains
@@ -35,7 +35,7 @@ class LabTestOrder
35
35
  :order_number => requisition_id
36
36
  }
37
37
 
38
- cover_letter_file_path = "#{FIXTURE_PATH}/uhc_requisition_cover_letter.pdf"
38
+ cover_letter_file_path = "#{FIXTURE_PATH}/pdfs/uhc_requisition_cover_letter.pdf"
39
39
 
40
40
  @pdf_requisition = Medivo::PdfGroup.create do
41
41
  variable_fields(cover_letter_file_path, cover_letter_fields)
@@ -55,8 +55,8 @@ class LabTestOrder
55
55
  :order_number => requisition_id
56
56
  }
57
57
 
58
- cover_letter_file_path = "#{FIXTURE_PATH}/uhc_result_cover_letter.pdf"
59
- faq_path = "#{FIXTURE_PATH}/hepc_result_faq.pdf"
58
+ cover_letter_file_path = "#{FIXTURE_PATH}/pdfs/uhc_result_cover_letter.pdf"
59
+ faq_path = "#{FIXTURE_PATH}/pdfs/hepc_result_faq.pdf"
60
60
 
61
61
  @pdf_result = Medivo::PdfGroup.create do
62
62
  variable_fields(cover_letter_file_path, cover_letter_fields)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2161036180 !ruby/object:Gem::Requirement
17
+ requirement: &2153066860 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2161036180
25
+ version_requirements: *2153066860
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2161035760 !ruby/object:Gem::Requirement
28
+ requirement: &2153066420 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2161035760
36
+ version_requirements: *2153066420
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2161035300 !ruby/object:Gem::Requirement
39
+ requirement: &2153065960 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2161035300
47
+ version_requirements: *2153065960
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2161034880 !ruby/object:Gem::Requirement
50
+ requirement: &2153065520 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2161034880
58
+ version_requirements: *2153065520
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2161034380 !ruby/object:Gem::Requirement
61
+ requirement: &2153065100 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2161034380
69
+ version_requirements: *2153065100
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2161033960 !ruby/object:Gem::Requirement
72
+ requirement: &2153064660 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2161033960
80
+ version_requirements: *2153064660
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdfkit
83
- requirement: &2161033540 !ruby/object:Gem::Requirement
83
+ requirement: &2153064240 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *2161033540
91
+ version_requirements: *2153064240
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: prawn
94
- requirement: &2161033100 !ruby/object:Gem::Requirement
94
+ requirement: &2153063740 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '0'
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *2161033100
102
+ version_requirements: *2153063740
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -263,15 +263,16 @@ files:
263
263
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
264
264
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
265
265
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
266
- - spec/fixtures/hepc_negative_results.pdf
267
- - spec/fixtures/hepc_result_faq.pdf
268
- - spec/fixtures/lc_order_with_normal_results.xml
269
- - spec/fixtures/lc_order_with_positive_results.xml
270
- - spec/fixtures/lc_order_with_requisition.xml
271
- - spec/fixtures/Southeast.jpg
272
- - spec/fixtures/uhc_requisition_cover_letter.pdf
273
- - spec/fixtures/uhc_result_cover_letter.pdf
274
- - spec/fixtures/valid_uhc_order.xml
266
+ - spec/dummy/tmp/pids/server.pid
267
+ - spec/fixtures/images/southeast.jpg
268
+ - spec/fixtures/pdfs/hepc_negative_results.pdf
269
+ - spec/fixtures/pdfs/hepc_result_faq.pdf
270
+ - spec/fixtures/pdfs/uhc_requisition_cover_letter.pdf
271
+ - spec/fixtures/pdfs/uhc_result_cover_letter.pdf
272
+ - spec/fixtures/xml/lc_order_with_normal_results.xml
273
+ - spec/fixtures/xml/lc_order_with_positive_results.xml
274
+ - spec/fixtures/xml/lc_order_with_requisition.xml
275
+ - spec/fixtures/xml/valid_uhc_order.xml
275
276
  - spec/lib/fdf_generator_spec.rb
276
277
  - spec/lib/pdf_generator_spec.rb
277
278
  - spec/lib/pdf_group_spec.rb
@@ -300,7 +301,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
301
  version: '0'
301
302
  segments:
302
303
  - 0
303
- hash: 2876077184686065658
304
+ hash: 56929817900109279
304
305
  required_rubygems_version: !ruby/object:Gem::Requirement
305
306
  none: false
306
307
  requirements:
@@ -309,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
310
  version: '0'
310
311
  segments:
311
312
  - 0
312
- hash: 2876077184686065658
313
+ hash: 56929817900109279
313
314
  requirements: []
314
315
  rubyforge_project:
315
316
  rubygems_version: 1.6.2
@@ -412,15 +413,16 @@ test_files:
412
413
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
413
414
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
414
415
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
415
- - spec/fixtures/hepc_negative_results.pdf
416
- - spec/fixtures/hepc_result_faq.pdf
417
- - spec/fixtures/lc_order_with_normal_results.xml
418
- - spec/fixtures/lc_order_with_positive_results.xml
419
- - spec/fixtures/lc_order_with_requisition.xml
420
- - spec/fixtures/Southeast.jpg
421
- - spec/fixtures/uhc_requisition_cover_letter.pdf
422
- - spec/fixtures/uhc_result_cover_letter.pdf
423
- - spec/fixtures/valid_uhc_order.xml
416
+ - spec/dummy/tmp/pids/server.pid
417
+ - spec/fixtures/images/southeast.jpg
418
+ - spec/fixtures/pdfs/hepc_negative_results.pdf
419
+ - spec/fixtures/pdfs/hepc_result_faq.pdf
420
+ - spec/fixtures/pdfs/uhc_requisition_cover_letter.pdf
421
+ - spec/fixtures/pdfs/uhc_result_cover_letter.pdf
422
+ - spec/fixtures/xml/lc_order_with_normal_results.xml
423
+ - spec/fixtures/xml/lc_order_with_positive_results.xml
424
+ - spec/fixtures/xml/lc_order_with_requisition.xml
425
+ - spec/fixtures/xml/valid_uhc_order.xml
424
426
  - spec/lib/fdf_generator_spec.rb
425
427
  - spec/lib/pdf_generator_spec.rb
426
428
  - spec/lib/pdf_group_spec.rb