C0 code coverage information
Generated on Mon Dec 08 16:53:36 -0800 2008 with rcov 0.8.1.3
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 class Patient < ActiveRecord::Base
2 has_many :patient_visits, :dependent => :destroy
3 has_many :patient_conditions, :through => :patient_visits
4 has_many :patient_allergies, :dependent => :destroy
5 has_many :patient_vaccinations, :dependent => :destroy
6 has_many :doctors, :through => :patient_visits
7
8 validates_presence_of :first_name
9 validates_presence_of :last_name
10 validates_presence_of :gender
11 validates_presence_of :date_of_birth
12 validates_presence_of :arrival_date
13
14 validates_uniqueness_of :first_name,
15 :scope => [:middle_name, :last_name],
16 :message => ', middle name and last name combination is already in our database. Please enter a unique patient name.'
17
18 validates_date :date_of_birth, :allow_nil => true
19 validates_date :arrival_date, :allow_nil => true
20
21 validates_length_of :first_name, :maximum => 100, :allow_blank => true
22 validates_length_of :middle_name, :maximum => 100, :allow_blank => true
23 validates_length_of :last_name, :maximum => 100, :allow_blank => true
24 validates_length_of :city, :maximum => 100, :allow_blank => true
25 validates_length_of :address, :maximum => 100, :allow_blank => true
26 validates_length_of :state, :maximum => 100, :allow_blank => true
27 validates_length_of :zip, :maximum => 100, :allow_blank => true
28 validates_length_of :father_first_name, :maximum => 100, :allow_blank => true
29 validates_length_of :father_last_name, :maximum => 100, :allow_blank => true
30 validates_length_of :mother_first_name, :maximum => 100, :allow_blank => true
31 validates_length_of :mother_last_name, :maximum => 100, :allow_blank => true
32 validates_length_of :telephone, :maximum => 100, :allow_blank => true
33 validates_length_of :emergency_contact_name, :maximum => 100, :allow_blank => true
34 validates_length_of :emergency_contact_relationship,
35 :maximum => 100, :allow_blank => true
36 validates_length_of :emergency_contact_number,
37 :maximum => 100, :allow_blank => true
38 validates_length_of :patient_remarks, :maximum => 10000, :allow_blank => true
39
40 validates_format_of :gender, :with =>/\A(Male|Female)\Z/i, :allow_blank => true
41
42 def conditions
43 conds = Array.new
44 patient_conditions.each do |pc|
45 conds << pc.condition
46 end
47 conds
48 end
49
50 def patient_medications
51 pres = Array.new
52 patient_conditions.each do |pc|
53 pc.patient_medications.each do |p|
54 pres << p
55 end
56 end
57 pres
58 end
59
60 def medications
61 meds = Array.new
62 patient_medications.each do |p|
63 meds << p.medication
64 end
65 meds
66 end
67 end
68
Generated using the rcov code coverage analysis tool for Ruby
version 0.8.1.3.