medivo 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/medivo/version.rb +1 -1
- data/lib/pdf/medivo/pdf_generator.rb +2 -2
- data/lib/pdf/medivo/pdf_group.rb +20 -15
- data/spec/controllers/orders_controller_spec.rb +27 -0
- data/spec/dummy/app/controllers/orders_controller.rb +15 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/log/test.log +386 -0
- data/spec/fixtures/lc_order_with_normal_results.xml +2 -2
- data/spec/fixtures/lc_order_with_positive_results.xml +2 -2
- data/spec/fixtures/uhc_result_cover_letter.pdf +9229 -9
- data/spec/lib/pdf_group_spec.rb +12 -29
- data/spec/models/lab_test_order_spec.rb +23 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/helper.rb +0 -1
- data/spec/support/sample_data.rb +66 -0
- metadata +30 -20
data/spec/lib/pdf_group_spec.rb
CHANGED
@@ -7,33 +7,10 @@ describe Medivo::PdfGroup do
|
|
7
7
|
pdf_group = Medivo::PdfGroup.create do
|
8
8
|
static_pdf(path)
|
9
9
|
end
|
10
|
-
|
11
|
-
pdf_group.
|
10
|
+
pdf_group.read.should_not be_empty
|
11
|
+
pdf_group.close
|
12
12
|
end
|
13
13
|
|
14
|
-
it "can access the local scope of calling class" do
|
15
|
-
class OrderTest
|
16
|
-
attr_reader :requisition_id
|
17
|
-
|
18
|
-
def initialize(requisition_id)
|
19
|
-
@requisition_id = requisition_id
|
20
|
-
end
|
21
|
-
|
22
|
-
def pdf_requisition
|
23
|
-
pdf_group = Medivo::PdfGroup.create do
|
24
|
-
lab_requisition(requisition_id)
|
25
|
-
end
|
26
|
-
pdf_group
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
requisition_id = 170420
|
31
|
-
stub_order_requisition(requisition_id, medivo_fixture_path("lc_order_with_requisition.xml"))
|
32
|
-
order = OrderTest.new( requisition_id )
|
33
|
-
order.pdf_requisition.read.should_not be nil
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
14
|
it "#variable_fields" do
|
38
15
|
name = "Duderoni"
|
39
16
|
o = OpenStruct.new(:name=>name)
|
@@ -43,6 +20,7 @@ describe Medivo::PdfGroup do
|
|
43
20
|
end
|
44
21
|
text = pdf_to_text(pdf_group.pdf)
|
45
22
|
text.should match name
|
23
|
+
pdf_group.close
|
46
24
|
end
|
47
25
|
|
48
26
|
it "#lab_requisition" do
|
@@ -54,7 +32,9 @@ describe Medivo::PdfGroup do
|
|
54
32
|
end
|
55
33
|
|
56
34
|
text = pdf_to_text(pdf_group.pdf)
|
57
|
-
text.should match
|
35
|
+
text.should match "Account #:111111111"
|
36
|
+
text.should match "This order expires 2012-02-12"
|
37
|
+
pdf_group.close
|
58
38
|
end
|
59
39
|
|
60
40
|
it "#lab_result" do
|
@@ -67,6 +47,7 @@ describe Medivo::PdfGroup do
|
|
67
47
|
|
68
48
|
text = pdf_to_text(pdf_group.pdf)
|
69
49
|
text.strip_space.should match "COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06".strip_space
|
50
|
+
pdf_group.close
|
70
51
|
end
|
71
52
|
|
72
53
|
it "#static_pdf" do
|
@@ -77,6 +58,7 @@ describe Medivo::PdfGroup do
|
|
77
58
|
|
78
59
|
text = pdf_to_text(pdf_group.pdf)
|
79
60
|
text.strip_space.should match "Q: What does a positive result mean".strip_space
|
61
|
+
pdf_group.close
|
80
62
|
end
|
81
63
|
|
82
64
|
it "handles a combination of pdfs" do
|
@@ -84,20 +66,21 @@ describe Medivo::PdfGroup do
|
|
84
66
|
cover_letter_path = medivo_fixture_path "negative_results.pdf"
|
85
67
|
|
86
68
|
requisition_id = 170420
|
87
|
-
|
69
|
+
stub_order_result(requisition_id, medivo_fixture_path("lc_order_with_normal_results.xml"))
|
88
70
|
|
89
71
|
faq_path = medivo_fixture_path "result_faq.pdf"
|
90
72
|
|
91
73
|
pdf_group = Medivo::PdfGroup.create do
|
92
74
|
variable_fields(cover_letter_path, {:patient_name=>name})
|
93
|
-
|
75
|
+
lab_result(requisition_id)
|
94
76
|
static_pdf(faq_path)
|
95
77
|
end
|
96
78
|
|
97
79
|
text = pdf_to_text(pdf_group.pdf)
|
98
80
|
text = text.strip_space
|
99
81
|
text.should match name
|
100
|
-
text.should match "
|
82
|
+
text.strip_space.should match "COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06".strip_space
|
101
83
|
text.should match "Q: What does a positive result mean".strip_space
|
84
|
+
pdf_group.close
|
102
85
|
end
|
103
86
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LabTestOrder do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@requisition_id = 170420
|
7
|
+
user = SampleUser
|
8
|
+
@lab_order = LabTestOrder.new(@requisition_id, user)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "#pdf_requisition" do
|
12
|
+
stub_order_requisition(@requisition_id, medivo_fixture_path("lc_order_with_requisition.xml"))
|
13
|
+
@lab_order.pdf_requisition.read.size.should > 30000
|
14
|
+
@lab_order.pdf_requisition.close
|
15
|
+
end
|
16
|
+
|
17
|
+
it "#pdf_result" do
|
18
|
+
stub_order_result(@requisition_id, medivo_fixture_path("lc_order_with_normal_results.xml"))
|
19
|
+
@lab_order.pdf_result.read.size.should > 30000
|
20
|
+
@lab_order.pdf_result.close
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -40,8 +40,10 @@ Spork.prefork do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
ENGINE_PATH = File.expand_path('../..', __FILE__) unless defined? ENGINE_PATH
|
43
|
+
FIXTURE_PATH = File.expand_path('../../spec/fixtures', __FILE__) unless defined? FIXTURE_PATH
|
43
44
|
Spork.each_run do
|
44
45
|
Dir["#{Rails.root}/app/**/*.rb"].each { |f| load f }
|
46
|
+
load "#{Rails.root}/config/routes.rb"
|
45
47
|
|
46
48
|
Dir["#{ENGINE_PATH}/app/**/*.rb"].each { |f| load f }
|
47
49
|
Dir["#{ENGINE_PATH}/lib/support/**/*.rb"].each { |f| load f }
|
data/spec/support/helper.rb
CHANGED
@@ -0,0 +1,66 @@
|
|
1
|
+
unless defined? SampleUser
|
2
|
+
SampleUser = OpenStruct.new(
|
3
|
+
:member_id => 1,
|
4
|
+
:date_of_birth => Date.new(1938, 3, 3),
|
5
|
+
:address1 => "422 Cattelranchy St",
|
6
|
+
:city => "Dudeville",
|
7
|
+
:state => "NY",
|
8
|
+
:zip_code => "10000",
|
9
|
+
:phone_number => '6461232334',
|
10
|
+
:lab_order => nil
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
class LabTestOrder
|
16
|
+
attr_accessor :requisition_id, :user
|
17
|
+
|
18
|
+
def initialize(requisition_id, user=nil)
|
19
|
+
@requisition_id = requisition_id
|
20
|
+
@user = user
|
21
|
+
end
|
22
|
+
|
23
|
+
def pdf_requisition
|
24
|
+
return @pdf_requisition if @pdf_requisition
|
25
|
+
|
26
|
+
cover_letter_fields = {
|
27
|
+
:full_name => user.full_name,
|
28
|
+
:address => "#{user.address1}\n#{user.address2}\n#{user.city}, #{user.state} #{user.zip_code}",
|
29
|
+
:first_name => user.first_name,
|
30
|
+
:sched_date => Date.today.to_s,
|
31
|
+
:lab_name => 'LabCorp',
|
32
|
+
:order_number => requisition_id
|
33
|
+
}
|
34
|
+
|
35
|
+
cover_letter_file_path = "#{FIXTURE_PATH}/uhc_requisition_cover_letter.pdf"
|
36
|
+
faq_path = "#{FIXTURE_PATH}/result_faq.pdf"
|
37
|
+
|
38
|
+
@pdf_requisition = Medivo::PdfGroup.create do
|
39
|
+
variable_fields(cover_letter_file_path, cover_letter_fields)
|
40
|
+
lab_requisition(requisition_id)
|
41
|
+
static_pdf(faq_path)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def pdf_result
|
46
|
+
return @pdf_result if @pdf_result
|
47
|
+
|
48
|
+
cover_letter_fields = {
|
49
|
+
:full_name => user.full_name,
|
50
|
+
:address => "#{user.address1}\n#{user.address2}\n#{user.city}, #{user.state} #{user.zip_code}",
|
51
|
+
:first_name => user.first_name,
|
52
|
+
:sched_date => Date.today.to_s,
|
53
|
+
:lab_name => 'LabCorp',
|
54
|
+
:order_number => requisition_id
|
55
|
+
}
|
56
|
+
|
57
|
+
cover_letter_file_path = "#{FIXTURE_PATH}/uhc_result_cover_letter.pdf"
|
58
|
+
|
59
|
+
Medivo::PdfGroup.create do
|
60
|
+
variable_fields(cover_letter_file_path, cover_letter_fields)
|
61
|
+
lab_result(requisition_id)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
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.1.
|
4
|
+
version: 0.1.18
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-08 00:00:00.000000000 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &2170124640 !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: *
|
25
|
+
version_requirements: *2170124640
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: jquery-rails
|
28
|
-
requirement: &
|
28
|
+
requirement: &2170124220 !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: *
|
36
|
+
version_requirements: *2170124220
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: coffee-script
|
39
|
-
requirement: &
|
39
|
+
requirement: &2170123760 !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: *
|
47
|
+
version_requirements: *2170123760
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: haml-rails
|
50
|
-
requirement: &
|
50
|
+
requirement: &2170123340 !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: *
|
58
|
+
version_requirements: *2170123340
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: geocoder
|
61
|
-
requirement: &
|
61
|
+
requirement: &2170122920 !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: *
|
69
|
+
version_requirements: *2170122920
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rest-client
|
72
|
-
requirement: &
|
72
|
+
requirement: &2170122500 !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: *
|
80
|
+
version_requirements: *2170122500
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: pdfkit
|
83
|
-
requirement: &
|
83
|
+
requirement: &2170122080 !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: *
|
91
|
+
version_requirements: *2170122080
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: prawn
|
94
|
-
requirement: &
|
94
|
+
requirement: &2170121660 !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: *
|
102
|
+
version_requirements: *2170121660
|
103
103
|
description: Use the medivo platform to find lab locations, make labcorp appointments,
|
104
104
|
place lab orders
|
105
105
|
email:
|
@@ -166,10 +166,12 @@ files:
|
|
166
166
|
- MIT-LICENSE
|
167
167
|
- Rakefile
|
168
168
|
- README.rdoc
|
169
|
+
- spec/controllers/orders_controller_spec.rb
|
169
170
|
- spec/dummy/app/assets/javascripts/application.js
|
170
171
|
- spec/dummy/app/assets/stylesheets/application.css
|
171
172
|
- spec/dummy/app/controllers/application_controller.rb
|
172
173
|
- spec/dummy/app/controllers/labs_controller.rb
|
174
|
+
- spec/dummy/app/controllers/orders_controller.rb
|
173
175
|
- spec/dummy/app/helpers/application_helper.rb
|
174
176
|
- spec/dummy/app/views/labs/search.html.haml
|
175
177
|
- spec/dummy/app/views/layouts/application.html.haml
|
@@ -266,11 +268,13 @@ files:
|
|
266
268
|
- spec/fixtures/result_faq.pdf
|
267
269
|
- spec/fixtures/Southeast.jpg
|
268
270
|
- spec/fixtures/uhc_requisition_cover_letter.pdf
|
271
|
+
- spec/fixtures/uhc_result_cover_letter.pdf
|
269
272
|
- spec/fixtures/valid_uhc_order.xml
|
270
273
|
- spec/lib/fdf_generator_spec.rb
|
271
274
|
- spec/lib/pdf_generator_spec.rb
|
272
275
|
- spec/lib/pdf_group_spec.rb
|
273
276
|
- spec/models/appointment_spec.rb
|
277
|
+
- spec/models/lab_test_order_spec.rb
|
274
278
|
- spec/models/labs_spec.rb
|
275
279
|
- spec/models/orders_spec.rb
|
276
280
|
- spec/models/primary_insurance_spec.rb
|
@@ -278,6 +282,7 @@ files:
|
|
278
282
|
- spec/spec_helper.rb
|
279
283
|
- spec/support/blueprints.rb
|
280
284
|
- spec/support/helper.rb
|
285
|
+
- spec/support/sample_data.rb
|
281
286
|
has_rdoc: true
|
282
287
|
homepage: http://www.medivo.com
|
283
288
|
licenses: []
|
@@ -293,7 +298,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
293
298
|
version: '0'
|
294
299
|
segments:
|
295
300
|
- 0
|
296
|
-
hash:
|
301
|
+
hash: 1506057069429317681
|
297
302
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
303
|
none: false
|
299
304
|
requirements:
|
@@ -302,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
307
|
version: '0'
|
303
308
|
segments:
|
304
309
|
- 0
|
305
|
-
hash:
|
310
|
+
hash: 1506057069429317681
|
306
311
|
requirements: []
|
307
312
|
rubyforge_project:
|
308
313
|
rubygems_version: 1.6.2
|
@@ -310,10 +315,12 @@ signing_key:
|
|
310
315
|
specification_version: 3
|
311
316
|
summary: interact with medivo resources
|
312
317
|
test_files:
|
318
|
+
- spec/controllers/orders_controller_spec.rb
|
313
319
|
- spec/dummy/app/assets/javascripts/application.js
|
314
320
|
- spec/dummy/app/assets/stylesheets/application.css
|
315
321
|
- spec/dummy/app/controllers/application_controller.rb
|
316
322
|
- spec/dummy/app/controllers/labs_controller.rb
|
323
|
+
- spec/dummy/app/controllers/orders_controller.rb
|
317
324
|
- spec/dummy/app/helpers/application_helper.rb
|
318
325
|
- spec/dummy/app/views/labs/search.html.haml
|
319
326
|
- spec/dummy/app/views/layouts/application.html.haml
|
@@ -410,11 +417,13 @@ test_files:
|
|
410
417
|
- spec/fixtures/result_faq.pdf
|
411
418
|
- spec/fixtures/Southeast.jpg
|
412
419
|
- spec/fixtures/uhc_requisition_cover_letter.pdf
|
420
|
+
- spec/fixtures/uhc_result_cover_letter.pdf
|
413
421
|
- spec/fixtures/valid_uhc_order.xml
|
414
422
|
- spec/lib/fdf_generator_spec.rb
|
415
423
|
- spec/lib/pdf_generator_spec.rb
|
416
424
|
- spec/lib/pdf_group_spec.rb
|
417
425
|
- spec/models/appointment_spec.rb
|
426
|
+
- spec/models/lab_test_order_spec.rb
|
418
427
|
- spec/models/labs_spec.rb
|
419
428
|
- spec/models/orders_spec.rb
|
420
429
|
- spec/models/primary_insurance_spec.rb
|
@@ -422,3 +431,4 @@ test_files:
|
|
422
431
|
- spec/spec_helper.rb
|
423
432
|
- spec/support/blueprints.rb
|
424
433
|
- spec/support/helper.rb
|
434
|
+
- spec/support/sample_data.rb
|