medivo 0.0.2 → 0.0.3

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.
Files changed (33) hide show
  1. data/app/assets/javascripts/medivo/models.coffee +8 -2
  2. data/app/assets/javascripts/medivo/show_labs.coffee +1 -0
  3. data/app/assets/javascripts/medivo/{map.coffee → views.coffee} +5 -3
  4. data/app/models/medivo/lab.rb +1 -1
  5. data/app/models/medivo/order.rb +16 -9
  6. data/lib/medivo/version.rb +1 -1
  7. data/spec/dummy/app/assets/javascripts/application.js +1 -1
  8. data/spec/dummy/app/views/labs/search.html.haml +3 -2
  9. data/spec/dummy/log/development.log +315 -0
  10. data/spec/dummy/log/test.log +28 -0
  11. data/spec/dummy/tmp/cache/assets/C46/F00/sprockets%2F2281d588b540056c5a7306c32a3761b9 +0 -0
  12. data/spec/dummy/tmp/cache/assets/CAB/970/sprockets%2F6aa4308273851c94a14158394d4dcdc4 +0 -0
  13. data/spec/dummy/tmp/cache/assets/CC3/EF0/sprockets%2F453b504c1f8f374578636f699eaa455d +0 -0
  14. data/spec/dummy/tmp/cache/assets/CE4/E70/sprockets%2F091ec16b8699113092ce35de93ca1d87 +0 -0
  15. data/spec/dummy/tmp/cache/assets/CEE/250/sprockets%2F96688f33f2f8aa261bf6701c1d6d7575 +0 -0
  16. data/spec/dummy/tmp/cache/assets/CFF/7F0/sprockets%2F4007fd53da973506c55bc273a05c5c0d +0 -0
  17. data/spec/dummy/tmp/cache/assets/D19/310/sprockets%2F110931639fc185699ea1aaaf87dd488b +0 -0
  18. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  19. data/spec/dummy/tmp/cache/assets/D45/320/sprockets%2Fc50ff379a1bdf1dd4d22249058749cf6 +0 -0
  20. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  21. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  22. data/spec/dummy/tmp/cache/assets/D9C/F50/sprockets%2F224e78bb9e1c414a2d518a3aaffd6f77 +0 -0
  23. data/spec/dummy/tmp/cache/assets/DA2/040/sprockets%2F6ab79dcced8cc9933b734e7b21c3a183 +0 -0
  24. data/spec/dummy/tmp/cache/assets/DD1/FD0/sprockets%2Fa531f33dc9c5852d39d64a9eda44dacf +0 -0
  25. data/spec/dummy/tmp/cache/assets/DD2/A50/sprockets%2Fecb5dd9066b50eb678cd8c9dbb21d229 +0 -0
  26. data/spec/dummy/tmp/cache/assets/DD4/2B0/sprockets%2Fef214a63f29afe7f3cbffc65af943108 +0 -0
  27. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  28. data/spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58 +0 -0
  29. data/spec/dummy/tmp/pids/server.pid +1 -1
  30. data/spec/models/orders_spec.rb +51 -7
  31. data/spec/requests/labs_spec.rb +4 -4
  32. data/spec/support/blueprints.rb +1 -0
  33. metadata +23 -19
@@ -27,10 +27,11 @@ Handlebars.registerHelper("address_without_comma", (lab)->
27
27
 
28
28
  ########## Lab model ##############
29
29
  class window.Lab
30
- constructor: (@data)->
31
30
  marker: null
32
31
  map_tooltip_template: Handlebars.compile("{{titleize name}}\n{{address_without_comma address}}\n{{titleize city}},{{state}} ")
33
32
 
33
+ constructor: (@data)->
34
+
34
35
  clearMarker: ->
35
36
  if this.marker
36
37
  this.marker.setMap(null)
@@ -55,11 +56,16 @@ class window.Lab
55
56
 
56
57
  ########## LabList model ##############
57
58
  class window.LabList
59
+ show_number: 3
58
60
 
59
- constructor: (lab_info)->
61
+ constructor: (lab_info, show_number)->
60
62
  @labs = []
63
+ @show_number = show_number if show_number
64
+ console.log(@show_number)
61
65
  this.setLabs(lab_info)
62
66
 
67
+ getLabs: -> @labs.slice(0, @show_number)
68
+
63
69
  setLabs: (lab_info)->
64
70
  this.clearMarkers()
65
71
  labs = @labs = []
@@ -4,6 +4,7 @@ $(document).ready ->
4
4
  lab_list = null
5
5
  data = $('#lab_list_container').data('labs')
6
6
  if data
7
+ # can limit the number of labs to show with option show_labs in LabList constructor
7
8
  lab_list = new window.LabList( data.labs )
8
9
  map_view = new window.MapView( lab_list, data.zip_location )
9
10
  lab_list_view = new window.LabListView( lab_list )
@@ -1,17 +1,19 @@
1
+ ############### LabList view ###############
1
2
  class window.LabListView
2
3
  el: null
3
4
  template: null
4
5
 
5
6
  constructor: (@lab_list)->
6
- this.el = $('ul#lab_list')
7
+ this.el = $('#lab_list')
7
8
  this.template = Handlebars.compile($('#lab_item_template').html())
8
9
  this.render()
9
10
 
10
11
  render: ->
11
12
  view = this
12
13
  view.el.empty()
13
- $.each( @lab_list.labs, (index, lab)-> view.el.append( $(view.template(lab.data)) ) )
14
+ $.each( @lab_list.getLabs(), (index, lab)-> view.el.append( $(view.template(lab.data)) ) )
14
15
 
16
+ ############### Map view ###############
15
17
  class window.MapView
16
18
  constructor: (@collection, @center_point)->
17
19
  throw "you need a collection to make a MapView" unless @collection
@@ -44,7 +46,7 @@ class window.MapView
44
46
  this.markerBounds.extend(this.center_marker.position) if this.markerBounds and this.center_marker
45
47
 
46
48
  setMarkers: (map, markerBounds) ->
47
- $.each( @collection.labs, (index, model)-> model.setMarker(map, markerBounds) )
49
+ $.each( @collection.getLabs(), (index, model)-> model.setMarker(map, markerBounds) )
48
50
 
49
51
  clear: ->
50
52
  this.collection.clearMarkers()
@@ -17,7 +17,7 @@ module Medivo
17
17
  def self.data_for_zip(zip='')
18
18
  zip = zip.to_s.match(/(\d{5})/) ? $1 : nil
19
19
  return {} unless zip and zip_info = ZipCode.find_by_zip_code(zip)
20
- labs = findLabs(zip)[0..1]
20
+ labs = findLabs(zip)
21
21
  {:labs => labs, :zip_location => zip_info.center_info}
22
22
  end
23
23
 
@@ -21,6 +21,22 @@ module Medivo
21
21
  self.take_tests_same_day = true
22
22
  end
23
23
 
24
+ # overriding save to return false if it does not save without errors
25
+ def save
26
+ new? ? create : update
27
+ valid?
28
+ end
29
+
30
+ # overriding create to capture 404 status and put that in error
31
+ # messages instead of throwing exception
32
+ def create
33
+ super
34
+ @remote_errors = nil
35
+ rescue ActiveResource::ResourceNotFound => e
36
+ @remote_errors = e
37
+ load_remote_errors(e,true)
38
+ end
39
+
24
40
  def to_param
25
41
  requisition_id
26
42
  end
@@ -33,15 +49,6 @@ module Medivo
33
49
  find(requsition_id)
34
50
  end
35
51
 
36
- # medivo_order = create(values)
37
- # unless medivo_order.valid?
38
- # Rails.logger.error("Error creating Medivo Lab order")
39
- # Rails.logger.error(medivo_order.inspect)
40
- # raise "Errors in Medivo Lab order #{medivo_order.errors.messages}"
41
- # end
42
- # medivo_order
43
- #end
44
-
45
52
  def results
46
53
  @results ||= Array.wrap(try(:reconciled_results).try(:result))
47
54
  end
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,7 +7,7 @@
7
7
  //= require jquery
8
8
  //= require jquery_ujs
9
9
  //= require medivo/handlebars
10
- //= require medivo/map
10
+ //= require medivo/views
11
11
  //= require medivo/models
12
12
  //= require medivo/show_labs
13
13
  //= require_tree .
@@ -2,7 +2,7 @@
2
2
  %script{:id=>"lab_item_template", :type=>"text/x-handlebars-template"}
3
3
  %li.lab_info
4
4
  .lab_image
5
- %img{:src=>"{{image}}", :width=>'12px'}  
5
+ -#%img{:src=>"{{image}}", :width=>'12px'}  
6
6
  %div
7
7
  .lab_name
8
8
  {{lab_name}}
@@ -11,6 +11,7 @@
11
11
  .phone
12
12
  Tel: {{telephone}}
13
13
  .link
14
+ // create your own /labs/select via :post method
14
15
  = form_for :lab, :url=>'/select', :method=>'post' do |f|
15
16
  %input{ :type=>:hidden, :name => 'id', :value=>"{{id}}" }
16
17
  %input{ :type=>:hidden, :name => 'lab_id', :value=>"{{lab_id}}" }
@@ -26,7 +27,7 @@
26
27
  #map_canvas_container
27
28
  #map_canvas{:style => "width:500px; height:350px"}
28
29
 
29
- // lab list display
30
+ // lab list display .. using ul/li style but you can change that
30
31
  #lab_list_container{ 'data-labs'=>@lab_data.to_json }
31
32
  %ul#lab_list
32
33
 
@@ -4901,3 +4901,318 @@ Served asset /medivo/arrow.png - 304 Not Modified (0ms)
4901
4901
 
4902
4902
  Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-13 23:18:49 +0200
4903
4903
  Served asset /medivo/lab.png - 304 Not Modified (0ms)
4904
+
4905
+
4906
+ Started GET "/labs/search?zip_code=90210" for 127.0.0.1 at 2011-10-14 14:50:53 +0200
4907
+ Processing by LabsController#search as HTML
4908
+ Parameters: {"zip_code"=>"90210"}
4909
+ Medivo::ZipCode Load (0.5ms) SELECT "zip_codes".* FROM "zip_codes" WHERE "zip_codes"."zip_code" = '90210' LIMIT 1
4910
+ Rendered labs/search.html.haml within layouts/application (16.3ms)
4911
+ Compiled application.css (0ms) (pid 59011)
4912
+ Compiled application.js (8ms) (pid 59011)
4913
+ Compiled jquery.js (1ms) (pid 59011)
4914
+ Compiled jquery_ujs.js (0ms) (pid 59011)
4915
+ Compiled medivo/handlebars.js (0ms) (pid 59011)
4916
+ Compiled medivo/views.js (184ms) (pid 59011)
4917
+ Compiled medivo/models.js (175ms) (pid 59011)
4918
+ Compiled medivo/show_labs.js (162ms) (pid 59011)
4919
+ Completed 200 OK in 9568ms (Views: 691.4ms | ActiveRecord: 1.0ms)
4920
+
4921
+
4922
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4923
+ Served asset /jquery.js - 304 Not Modified (12ms)
4924
+
4925
+
4926
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4927
+ Served asset /application.css - 304 Not Modified (0ms)
4928
+
4929
+
4930
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4931
+ Served asset /medivo/views.js - 200 OK (2ms)
4932
+
4933
+
4934
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4935
+ Served asset /jquery_ujs.js - 304 Not Modified (1ms)
4936
+
4937
+
4938
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4939
+ Served asset /medivo/handlebars.js - 304 Not Modified (2ms)
4940
+
4941
+
4942
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4943
+ Served asset /medivo/models.js - 200 OK (2ms)
4944
+
4945
+
4946
+ Started GET "/assets/medivo/show_labs.js?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4947
+ Served asset /medivo/show_labs.js - 304 Not Modified (2ms)
4948
+
4949
+
4950
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4951
+ Served asset /application.js - 200 OK (0ms)
4952
+
4953
+
4954
+ Started GET "/labs/search?zip_code=90210" for 127.0.0.1 at 2011-10-14 14:51:03 +0200
4955
+ Processing by LabsController#search as */*
4956
+ Parameters: {"zip_code"=>"90210"}
4957
+ Medivo::ZipCode Load (0.1ms) SELECT "zip_codes".* FROM "zip_codes" WHERE "zip_codes"."zip_code" = '90210' LIMIT 1
4958
+ Rendered labs/search.html.haml within layouts/application (9.6ms)
4959
+ Completed 200 OK in 1681ms (Views: 15.7ms | ActiveRecord: 0.5ms)
4960
+
4961
+
4962
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-14 14:51:05 +0200
4963
+ Served asset /medivo/arrow.png - 304 Not Modified (2ms)
4964
+
4965
+
4966
+ Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-14 14:51:05 +0200
4967
+ Served asset /medivo/lab.png - 304 Not Modified (2ms)
4968
+
4969
+
4970
+ Started GET "/labs/search?zip_code=90210" for 127.0.0.1 at 2011-10-14 14:53:15 +0200
4971
+ Processing by LabsController#search as HTML
4972
+ Parameters: {"zip_code"=>"90210"}
4973
+ Medivo::ZipCode Load (0.1ms) SELECT "zip_codes".* FROM "zip_codes" WHERE "zip_codes"."zip_code" = '90210' LIMIT 1
4974
+ Rendered labs/search.html.haml within layouts/application (9.3ms)
4975
+ Completed 200 OK in 1731ms (Views: 14.1ms | ActiveRecord: 0.6ms)
4976
+
4977
+
4978
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
4979
+ Served asset /application.css - 304 Not Modified (0ms)
4980
+
4981
+
4982
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
4983
+ Served asset /jquery.js - 304 Not Modified (0ms)
4984
+
4985
+
4986
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
4987
+ Served asset /jquery_ujs.js - 304 Not Modified (0ms)
4988
+
4989
+
4990
+ Started GET "/assets/medivo/show_labs.js?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
4991
+ Served asset /medivo/show_labs.js - 304 Not Modified (0ms)
4992
+
4993
+
4994
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
4995
+ Served asset /medivo/handlebars.js - 304 Not Modified (0ms)
4996
+
4997
+
4998
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
4999
+ Served asset /medivo/views.js - 304 Not Modified (0ms)
5000
+
5001
+
5002
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
5003
+ Served asset /medivo/models.js - 304 Not Modified (0ms)
5004
+
5005
+
5006
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
5007
+ Served asset /application.js - 304 Not Modified (0ms)
5008
+
5009
+
5010
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
5011
+ Served asset /medivo/arrow.png - 304 Not Modified (0ms)
5012
+
5013
+
5014
+ Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-14 14:53:17 +0200
5015
+ Served asset /medivo/lab.png - 304 Not Modified (0ms)
5016
+
5017
+
5018
+ Started GET "/labs/search?utf8=%E2%9C%93&zip_code=90210&commit=Search" for 127.0.0.1 at 2011-10-14 16:43:49 +0200
5019
+ Processing by LabsController#search as HTML
5020
+ Parameters: {"utf8"=>"✓", "zip_code"=>"90210", "commit"=>"Search"}
5021
+ Medivo::ZipCode Load (2.3ms) SELECT "zip_codes".* FROM "zip_codes" WHERE "zip_codes"."zip_code" = '90210' LIMIT 1
5022
+ Rendered labs/search.html.haml within layouts/application (15.9ms)
5023
+ Compiled medivo/views.js (209ms) (pid 59208)
5024
+ Compiled medivo/models.js (199ms) (pid 59208)
5025
+ Compiled application.js (10ms) (pid 59208)
5026
+ Completed 200 OK in 2679ms (Views: 503.3ms | ActiveRecord: 2.8ms)
5027
+
5028
+
5029
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5030
+ Served asset /jquery.js - 304 Not Modified (5ms)
5031
+
5032
+
5033
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5034
+ Served asset /application.css - 304 Not Modified (0ms)
5035
+
5036
+
5037
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5038
+ Served asset /medivo/handlebars.js - 304 Not Modified (4ms)
5039
+
5040
+
5041
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5042
+ Served asset /medivo/views.js - 200 OK (2ms)
5043
+
5044
+
5045
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5046
+ Served asset /jquery_ujs.js - 304 Not Modified (27ms)
5047
+
5048
+
5049
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5050
+ Served asset /medivo/models.js - 200 OK (2ms)
5051
+
5052
+
5053
+ Started GET "/assets/medivo/show_labs.js?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5054
+ Served asset /medivo/show_labs.js - 304 Not Modified (2ms)
5055
+
5056
+
5057
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5058
+ Served asset /application.js - 200 OK (0ms)
5059
+
5060
+
5061
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5062
+ Served asset /medivo/arrow.png - 304 Not Modified (1ms)
5063
+
5064
+
5065
+ Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-14 16:43:53 +0200
5066
+ Served asset /medivo/lab.png - 304 Not Modified (2ms)
5067
+
5068
+
5069
+ Started GET "/labs/search?utf8=%E2%9C%93&zip_code=90210&commit=Search" for 127.0.0.1 at 2011-10-14 16:44:27 +0200
5070
+ Processing by LabsController#search as HTML
5071
+ Parameters: {"utf8"=>"✓", "zip_code"=>"90210", "commit"=>"Search"}
5072
+ Medivo::ZipCode Load (0.1ms) SELECT "zip_codes".* FROM "zip_codes" WHERE "zip_codes"."zip_code" = '90210' LIMIT 1
5073
+ Rendered labs/search.html.haml within layouts/application (3.2ms)
5074
+ Compiled medivo/show_labs.js (161ms) (pid 59208)
5075
+ Compiled application.js (9ms) (pid 59208)
5076
+ Completed 200 OK in 1826ms (Views: 194.3ms | ActiveRecord: 0.6ms)
5077
+
5078
+
5079
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5080
+ Served asset /application.css - 304 Not Modified (0ms)
5081
+
5082
+
5083
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5084
+ Served asset /jquery.js - 304 Not Modified (0ms)
5085
+
5086
+
5087
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5088
+ Served asset /jquery_ujs.js - 304 Not Modified (0ms)
5089
+
5090
+
5091
+ Started GET "/assets/medivo/show_labs.js?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5092
+ Served asset /medivo/show_labs.js - 200 OK (3ms)
5093
+
5094
+
5095
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5096
+ Served asset /medivo/handlebars.js - 304 Not Modified (0ms)
5097
+
5098
+
5099
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5100
+ Served asset /medivo/views.js - 304 Not Modified (0ms)
5101
+
5102
+
5103
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5104
+ Served asset /medivo/models.js - 304 Not Modified (0ms)
5105
+
5106
+
5107
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5108
+ Served asset /application.js - 200 OK (0ms)
5109
+
5110
+
5111
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5112
+ Served asset /medivo/arrow.png - 304 Not Modified (0ms)
5113
+
5114
+
5115
+ Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-14 16:44:29 +0200
5116
+ Served asset /medivo/lab.png - 304 Not Modified (0ms)
5117
+
5118
+
5119
+ Started GET "/labs/search?utf8=%E2%9C%93&zip_code=90210&commit=Search" for 127.0.0.1 at 2011-10-14 16:46:21 +0200
5120
+ Processing by LabsController#search as HTML
5121
+ Parameters: {"utf8"=>"✓", "zip_code"=>"90210", "commit"=>"Search"}
5122
+ Medivo::ZipCode Load (0.1ms) SELECT "zip_codes".* FROM "zip_codes" WHERE "zip_codes"."zip_code" = '90210' LIMIT 1
5123
+ Rendered labs/search.html.haml within layouts/application (20.0ms)
5124
+ Compiled medivo/views.js (174ms) (pid 59208)
5125
+ Compiled medivo/show_labs.js (161ms) (pid 59208)
5126
+ Compiled application.js (10ms) (pid 59208)
5127
+ Completed 200 OK in 2217ms (Views: 429.3ms | ActiveRecord: 0.6ms)
5128
+
5129
+
5130
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5131
+ Served asset /application.css - 304 Not Modified (0ms)
5132
+
5133
+
5134
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5135
+ Served asset /jquery.js - 304 Not Modified (0ms)
5136
+
5137
+
5138
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5139
+ Served asset /jquery_ujs.js - 304 Not Modified (0ms)
5140
+
5141
+
5142
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5143
+ Served asset /medivo/handlebars.js - 304 Not Modified (0ms)
5144
+
5145
+
5146
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5147
+ Served asset /medivo/views.js - 200 OK (3ms)
5148
+
5149
+
5150
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5151
+ Served asset /medivo/models.js - 304 Not Modified (0ms)
5152
+
5153
+
5154
+ Started GET "/assets/medivo/show_labs.js?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5155
+ Served asset /medivo/show_labs.js - 200 OK (2ms)
5156
+
5157
+
5158
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-14 16:46:23 +0200
5159
+ Served asset /application.js - 200 OK (0ms)
5160
+
5161
+
5162
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-14 16:46:24 +0200
5163
+ Served asset /medivo/arrow.png - 304 Not Modified (0ms)
5164
+
5165
+
5166
+ Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-14 16:46:24 +0200
5167
+ Served asset /medivo/lab.png - 304 Not Modified (0ms)
5168
+
5169
+
5170
+ Started GET "/labs/search?utf8=%E2%9C%93&zip_code=90210&commit=Search" for 127.0.0.1 at 2011-10-14 16:47:57 +0200
5171
+ Processing by LabsController#search as HTML
5172
+ Parameters: {"utf8"=>"✓", "zip_code"=>"90210", "commit"=>"Search"}
5173
+ Medivo::ZipCode Load (0.1ms) SELECT "zip_codes".* FROM "zip_codes" WHERE "zip_codes"."zip_code" = '90210' LIMIT 1
5174
+ Rendered labs/search.html.haml within layouts/application (20.4ms)
5175
+ Compiled medivo/models.js (174ms) (pid 59208)
5176
+ Compiled medivo/show_labs.js (162ms) (pid 59208)
5177
+ Compiled application.js (48ms) (pid 59208)
5178
+ Completed 200 OK in 1995ms (Views: 429.1ms | ActiveRecord: 0.7ms)
5179
+
5180
+
5181
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5182
+ Served asset /application.css - 304 Not Modified (0ms)
5183
+
5184
+
5185
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5186
+ Served asset /jquery.js - 304 Not Modified (0ms)
5187
+
5188
+
5189
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5190
+ Served asset /jquery_ujs.js - 304 Not Modified (0ms)
5191
+
5192
+
5193
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5194
+ Served asset /medivo/handlebars.js - 304 Not Modified (0ms)
5195
+
5196
+
5197
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5198
+ Served asset /medivo/views.js - 304 Not Modified (0ms)
5199
+
5200
+
5201
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5202
+ Served asset /medivo/models.js - 200 OK (2ms)
5203
+
5204
+
5205
+ Started GET "/assets/medivo/show_labs.js?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5206
+ Served asset /medivo/show_labs.js - 200 OK (2ms)
5207
+
5208
+
5209
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5210
+ Served asset /application.js - 200 OK (0ms)
5211
+
5212
+
5213
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5214
+ Served asset /medivo/arrow.png - 304 Not Modified (0ms)
5215
+
5216
+
5217
+ Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-14 16:47:59 +0200
5218
+ Served asset /medivo/lab.png - 304 Not Modified (0ms)
@@ -938,3 +938,31 @@ Served asset /medivo/arrow.png - 200 OK (5ms)
938
938
 
939
939
  Started GET "/assets/medivo/lab.png" for 127.0.0.1 at 2011-10-13 23:44:28 +0200
940
940
  Served asset /medivo/lab.png - 200 OK (1ms)
941
+
942
+
943
+ Started GET "/medivo/labs/data?zip_code=90210" for 127.0.0.1 at 2011-10-14 16:48:50 +0200
944
+ Processing by Medivo::LabsController#data as HTML
945
+ Parameters: {"zip_code"=>"90210"}
946
+ Completed 200 OK in 3ms (Views: 1.0ms | ActiveRecord: 0.0ms)
947
+
948
+
949
+ Started GET "/labs/search?zip_code=90210" for 127.0.0.1 at 2011-10-14 16:48:51 +0200
950
+ Processing by LabsController#search as HTML
951
+ Parameters: {"zip_code"=>"90210"}
952
+ Completed 200 OK in 112ms (Views: 111.8ms | ActiveRecord: 0.0ms)
953
+
954
+
955
+ Started GET "/assets/application.css" for 127.0.0.1 at 2011-10-14 16:48:51 +0200
956
+ Compiled application.css (1ms) (pid 59241)
957
+ Served asset /application.css - 200 OK (9ms)
958
+
959
+
960
+ Started GET "/assets/application.js" for 127.0.0.1 at 2011-10-14 16:48:51 +0200
961
+ Compiled application.js (8ms) (pid 59241)
962
+ Compiled jquery.js (1ms) (pid 59241)
963
+ Compiled jquery_ujs.js (0ms) (pid 59241)
964
+ Compiled medivo/handlebars.js (0ms) (pid 59241)
965
+ Compiled medivo/views.js (217ms) (pid 59241)
966
+ Compiled medivo/models.js (181ms) (pid 59241)
967
+ Compiled medivo/show_labs.js (171ms) (pid 59241)
968
+ Served asset /application.js - 200 OK (609ms)
@@ -1 +1 @@
1
- 55740
1
+ 59208
@@ -24,7 +24,7 @@ describe Medivo::Order do
24
24
  end
25
25
 
26
26
  it "test_types should be an array" do
27
- order = Medivo::Order.new({:test_types=>[1,2]})
27
+ order = Medivo::Order.new({:test_types=>[1, 2]})
28
28
  order.valid?
29
29
  order.errors.messages[:test_types].should == nil
30
30
  end
@@ -35,12 +35,56 @@ describe Medivo::Order do
35
35
  order.take_tests_same_day.should == true
36
36
  end
37
37
 
38
- #it "incorrect test ids returning 404" do
39
- # stub_request(:post, "http://test:test@test.medivo.com/customers.xml").
40
- # to_return(:status => 404)
41
- # order = Medivo::Order.new
42
- # p order.save(:validate => false)
43
- #end
38
+ it "save with incorrect test ids returning 404 sets an error message instead of throwing exception" do
39
+ stub_request(:post, "http://test:test@test.medivo.com/customers.xml").
40
+ to_return(:body => '<errors><error>Test type not found: 2020</error></errors>',
41
+ :status => 404)
42
+ order = Medivo::Order.new(
43
+ :email => "dude@dude.com",
44
+ :address=> "my house",
45
+ :zip=> "90210",
46
+ :dob=> "19801201",
47
+ :home_phone=> "4155551212",
48
+ :psc=> 11,
49
+ :test_types=> [2020],
50
+ :account_number => "423",
51
+ :gender => "Male",
52
+ :dob => "19801201")
53
+
54
+ order.save.should == false
55
+ order.valid?.should == false
56
+ order.errors.messages.keys.should include :base
57
+ order.errors.messages[:base].should == ["Test type not found: 2020"]
58
+
59
+ # fixing the problem .. it now saves and is valid
60
+ stub_request(:post, "http://test:test@test.medivo.com/customers.xml").
61
+ to_return(:status => 200)
62
+
63
+ order.save.should == true
64
+ order.valid?.should == true
65
+ end
66
+
67
+ it "create with incorrect test ids returning 404 sets an error message instead of throwing exception" do
68
+ stub_request(:post, "http://test:test@test.medivo.com/customers.xml").
69
+ to_return(:body => '<errors><error>Test type not found: 2020</error></errors>',
70
+ :status => 404)
71
+
72
+ order = Medivo::Order.create(
73
+ :email => "dude@dude.com",
74
+ :address=> "my house",
75
+ :zip=> "90210",
76
+ :dob=> "19801201",
77
+ :home_phone=> "4155551212",
78
+ :psc=> 11,
79
+ :test_types=> [2020],
80
+ :account_number => "423",
81
+ :gender => "Male",
82
+ :dob => "19801201")
83
+
84
+ order.valid?.should == false
85
+ order.errors.messages.keys.should include :base
86
+ order.errors.messages[:base].should == ["Test type not found: 2020"]
87
+ end
44
88
  end
45
89
 
46
90
  describe Medivo::InsuranceOrder do
@@ -6,7 +6,7 @@ describe 'LabController' do
6
6
  WebMock.allow_net_connect!
7
7
  end
8
8
 
9
- describe "#data" do
9
+ describe "showing lab list and map" do
10
10
 
11
11
  before do
12
12
  @zip_code = "90210"
@@ -14,7 +14,7 @@ describe 'LabController' do
14
14
  stub(Medivo::Lab).findLabs(@zip_code) { [BeverlyHillsLab1, BeverlyHillsLab2] }
15
15
  end
16
16
 
17
- it "returns lab and zip data" do
17
+ it "/labs/data returns lab and zip data as json" do
18
18
  visit Medivo::Engine.routes.url_helpers.data_labs_path :zip_code => @zip_code
19
19
  # can't seem to get json back .. just html .. but it works in rails server just fine
20
20
  # so testing for the string will have to do for now
@@ -22,8 +22,8 @@ describe 'LabController' do
22
22
  page.body.should match /#{BeverlyHillsLab2.name}/i
23
23
  end
24
24
 
25
- it "shows search results on the map", :js=>true, :driver=>:selenium_chrome do
26
- visit search_labs_path(:zip_code=>@zip_code)
25
+ it "/labs/search shows search results on the map and list", :js=>true, :driver=>:selenium_chrome do
26
+ visit search_labs_path :zip_code=>@zip_code
27
27
  page.body.should match /465 N ROXBURY DR STE 715, BEVERLY HILLS, CA/i
28
28
  page.body.should match /8737 BEVERLY BLVD STE 401, LOS ANGELES, CA/i
29
29
  end
@@ -52,3 +52,4 @@ BeverlyHillsLab2 = Medivo::Lab.new(
52
52
  "zip"=>"90048"
53
53
  }
54
54
  )
55
+
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.0.2
4
+ version: 0.0.3
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-10-13 00:00:00.000000000 +02:00
12
+ date: 2011-10-14 00:00:00.000000000 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2165007280 !ruby/object:Gem::Requirement
17
+ requirement: &2156666860 !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: *2165007280
25
+ version_requirements: *2156666860
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2165005940 !ruby/object:Gem::Requirement
28
+ requirement: &2156665360 !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: *2165005940
36
+ version_requirements: *2156665360
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2165004560 !ruby/object:Gem::Requirement
39
+ requirement: &2156663340 !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: *2165004560
47
+ version_requirements: *2156663340
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2165003600 !ruby/object:Gem::Requirement
50
+ requirement: &2156661740 !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: *2165003600
58
+ version_requirements: *2156661740
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: sqlite3
61
- requirement: &2165002700 !ruby/object:Gem::Requirement
61
+ requirement: &2156660740 !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: *2165002700
69
+ version_requirements: *2156660740
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: webmock
72
- requirement: &2165001820 !ruby/object:Gem::Requirement
72
+ requirement: &2156659700 !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: :development
79
79
  prerelease: false
80
- version_requirements: *2165001820
80
+ version_requirements: *2156659700
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: capybara
83
- requirement: &2165000120 !ruby/object:Gem::Requirement
83
+ requirement: &2156658740 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,7 +88,7 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2165000120
91
+ version_requirements: *2156658740
92
92
  description: Use the medivo platform to make a lab order or find a lab location
93
93
  email:
94
94
  - dsudol@medivo.com
@@ -100,9 +100,9 @@ files:
100
100
  - app/assets/images/medivo/lab.png
101
101
  - app/assets/javascripts/medivo/application.js
102
102
  - app/assets/javascripts/medivo/handlebars.js
103
- - app/assets/javascripts/medivo/map.coffee
104
103
  - app/assets/javascripts/medivo/models.coffee
105
104
  - app/assets/javascripts/medivo/show_labs.coffee
105
+ - app/assets/javascripts/medivo/views.coffee
106
106
  - app/assets/stylesheets/medivo/application.css
107
107
  - app/controllers/medivo/application_controller.rb
108
108
  - app/controllers/medivo/labs_controller.rb
@@ -168,12 +168,14 @@ files:
168
168
  - spec/dummy/tmp/cache/assets/CFF/8D0/sprockets%2Fc1053414055bf81a6d316dc14f12f9fd
169
169
  - spec/dummy/tmp/cache/assets/D19/310/sprockets%2F110931639fc185699ea1aaaf87dd488b
170
170
  - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
171
+ - spec/dummy/tmp/cache/assets/D45/320/sprockets%2Fc50ff379a1bdf1dd4d22249058749cf6
171
172
  - spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4
172
173
  - spec/dummy/tmp/cache/assets/D62/380/sprockets%2F712d93afe40570cc939133bddca13bc7
173
174
  - spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384
174
175
  - spec/dummy/tmp/cache/assets/D9C/F50/sprockets%2F224e78bb9e1c414a2d518a3aaffd6f77
175
176
  - spec/dummy/tmp/cache/assets/D9D/4E0/sprockets%2Fe9dab92986b1516fca08474613ccadcb
176
177
  - spec/dummy/tmp/cache/assets/DA2/040/sprockets%2F6ab79dcced8cc9933b734e7b21c3a183
178
+ - spec/dummy/tmp/cache/assets/DD1/FD0/sprockets%2Fa531f33dc9c5852d39d64a9eda44dacf
177
179
  - spec/dummy/tmp/cache/assets/DD2/A50/sprockets%2Fecb5dd9066b50eb678cd8c9dbb21d229
178
180
  - spec/dummy/tmp/cache/assets/DD4/2B0/sprockets%2Fef214a63f29afe7f3cbffc65af943108
179
181
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
@@ -199,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
201
  version: '0'
200
202
  segments:
201
203
  - 0
202
- hash: 1983744793530917805
204
+ hash: -2555924488673341874
203
205
  required_rubygems_version: !ruby/object:Gem::Requirement
204
206
  none: false
205
207
  requirements:
@@ -208,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
210
  version: '0'
209
211
  segments:
210
212
  - 0
211
- hash: 1983744793530917805
213
+ hash: -2555924488673341874
212
214
  requirements: []
213
215
  rubyforge_project:
214
216
  rubygems_version: 1.6.2
@@ -260,12 +262,14 @@ test_files:
260
262
  - spec/dummy/tmp/cache/assets/CFF/8D0/sprockets%2Fc1053414055bf81a6d316dc14f12f9fd
261
263
  - spec/dummy/tmp/cache/assets/D19/310/sprockets%2F110931639fc185699ea1aaaf87dd488b
262
264
  - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
265
+ - spec/dummy/tmp/cache/assets/D45/320/sprockets%2Fc50ff379a1bdf1dd4d22249058749cf6
263
266
  - spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4
264
267
  - spec/dummy/tmp/cache/assets/D62/380/sprockets%2F712d93afe40570cc939133bddca13bc7
265
268
  - spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384
266
269
  - spec/dummy/tmp/cache/assets/D9C/F50/sprockets%2F224e78bb9e1c414a2d518a3aaffd6f77
267
270
  - spec/dummy/tmp/cache/assets/D9D/4E0/sprockets%2Fe9dab92986b1516fca08474613ccadcb
268
271
  - spec/dummy/tmp/cache/assets/DA2/040/sprockets%2F6ab79dcced8cc9933b734e7b21c3a183
272
+ - spec/dummy/tmp/cache/assets/DD1/FD0/sprockets%2Fa531f33dc9c5852d39d64a9eda44dacf
269
273
  - spec/dummy/tmp/cache/assets/DD2/A50/sprockets%2Fecb5dd9066b50eb678cd8c9dbb21d229
270
274
  - spec/dummy/tmp/cache/assets/DD4/2B0/sprockets%2Fef214a63f29afe7f3cbffc65af943108
271
275
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af