Permalink
Browse files

All tests pass, no new features.

  • Loading branch information...
1 parent feaf2ea commit 0f3db93699a6f4a8e25012ae4498c5175bfa304d @MikeBlyth committed Jan 18, 2013
@@ -1,4 +1,5 @@
-class UsersController < ApplicationController
- active_scaffold :user do |conf|
- end
-end
+#NOTE!! Users is currently handled by authentication package, so does not need to be defined here
+#class UsersController < ApplicationController
+# active_scaffold :user do |conf|
+# end
+#end
View
@@ -34,8 +34,6 @@ class Patient < ActiveRecord::Base
include DateValidators
include NamesHelper
- attr_accessor :birth_date, :birth_time
-
attr_accessible :first_name, :ident, :last_name, :other_names, :sex, :residence, :phone, :caregiver, :birth_date,
:death_date, :birth_date, :birth_date_exact,:death_date,
:allergies, :hemoglobin_type, :hiv_status, :maternal_hiv_status
@@ -18,7 +18,7 @@
= form.input :ident, :input_html => {class: :span12 }
.row-fluid
.span2
- = form.input :birth_date2, as: :string, :input_html => {class: "span12 datepicker" }
+ = form.input :birth_date, as: :string, :input_html => {class: "span12 datepicker" }
.span2
= form.input :birth_date_exact, label: "Exact birth date?"
.span2
View
@@ -19,7 +19,7 @@
resources :providers do as_routes end
- resources :users do as_routes end
+ # resources :users do as_routes end # Will probably be handled by authentication program
resources :photos do as_routes end
@@ -0,0 +1,10 @@
+class RenamePatientBirthdate < ActiveRecord::Migration
+# Commented out as a way of bypassing this migration
+ def up
+# rename_column :patients, :birth_date, :birth_datetime
+ end
+
+ def down
+# rename_column :patients, :birth_datetime, :birth_date
+ end
+end
@@ -0,0 +1,5 @@
+class AddTimeZoneToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :time_zone, :string
+ end
+end
@@ -83,7 +83,7 @@
end
factory :lab_request do
- #date {Date.yesterday}
+ #date {1.day.ago}
patient
provider
end
@@ -100,7 +100,7 @@
sequence(:first_name) {|n| "First_#{n}" }
sequence(:ident) {|n| "P_#{n}" }
sex 'M'
- birth_date '2000-1-1'
+ birth_date Time.zone.parse '2000-1-1'
trait :hiv_pos do
hiv_status 'positive'
@@ -123,7 +123,7 @@
provider
trait :recent do
- date {Date.yesterday}
+ date {1.day.ago}
end
trait :old do
@@ -204,7 +204,7 @@
patient
trait :recent do
- date {Date.yesterday}
+ date {1.day.ago}
end
trait :old do
@@ -30,6 +30,6 @@
patient.last_name.should == 'Vivaldi'
patient.first_name.should == 'Antonio'
patient.ident.should == 'V001'
- patient.birth_date.to_date.should == Date.new(2012, 11, 21)
+ patient.birth_date.should == Time.new(2012, 11, 21).in_time_zone
end
end
@@ -38,7 +38,7 @@
create_logged_in_user
patient = FactoryGirl.create(:patient)
pt_id = patient.id
- rx = FactoryGirl.create :prescription_with_item, height: nil, weight: nil, date: Date.yesterday
+ rx = FactoryGirl.create :prescription_with_item, height: nil, weight: nil, date: 1.day.ago
provider = FactoryGirl.create(:provider, first_name: 'Jimmy')
puts "path=#{edit_prescription_path(rx)}"
visit edit_prescription_path(rx)
@@ -16,7 +16,7 @@
filled_values = fill_all_inputs(Visit, exclude: ['dx2'],
warnings: true,
head_circ: 70.0 ,
- next_visit: Date.tomorrow
+ next_visit: Time.zone.parse(Date.tomorrow.to_s)
)
click_button 'Create'
Visit.last.should_not be_nil
View
@@ -196,14 +196,15 @@ def fill_all_inputs(model, options={})
puts "Columns for #{model_name} not found in form: #{not_found}" if not_found.any?
puts "Columns for #{model_name} found but not filled: #{not_filled}" if not_filled.any?
end
+ #puts "Filled values = #{filled_values}"
return filled_values
end
# Called by fill_all_inputs to fill in given input
def fill_in_column(model_name, column, field_tag, value=nil)
field_name = "#{model_name}[#{column.name}]"
value ||= case column.type
- when :datetime, :date then Date.today - 1.day
+ when :datetime, :date then Time.zone.parse(Date.today.to_s) # just fills in date part, but keeps the TimeWithZone object
when :string, :text then "Data for #{column.name}"
when :integer then 5
when :float then 40
@@ -228,8 +229,8 @@ def check_all_equal(record, attributes)
end
end
if mismatched.any?
- puts "Attributes for #{record} do not match expected:"
- mismatched.each {|m| puts "\t#{m[:name]}: expected #{m[:expected]} but got #{m[:found]}"}
+ puts "\nAttributes for #{record} do not match expected:"
+ mismatched.each {|m| puts "\t#{m[:name]}: expected #{m[:expected].inspect} (#{m[:expected].class}) but got #{m[:found].inspect} (#{m[:found].class})"}
end
return mismatched.empty?
end

0 comments on commit 0f3db93

Please sign in to comment.