Skip to content

Instantly share code, notes, and snippets.

View wenbert's full-sized avatar

Wenbert Del Rosario wenbert

View GitHub Profile
@wenbert
wenbert / expired_in_123signup_and_not_in_cfai_list.sql
Created December 2, 2011 11:34
4. All those in the 123signup list who are listed as EXPIRED but are NOT listed in the CFAI list>>> Leave them EXPIRED in 123signup. But be ready to upgrade them when they are upgraded in CFAI
SELECT
onetwothree.`name`,
onetwothree.`email`, onetwothree.`exp_date`, onetwothree.`days_due`
FROM from_123 onetwothree
LEFT JOIN from_cfai cfai
ON cfai.email = onetwothree.email
require 'test_helper'
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:one)
end
test "should get index" do
get :index
assert_response :success
AllergiesControllerTest:
PASS should create allergy (0.17s)
PASS should destroy allergy (0.01s)
PASS should get edit (0.12s)
ERROR should get index (0.16s)
ActionView::Template::Error: undefined method `full_name' for nil:NilClass
/Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
1.9.2-p290 :005 > a = Allergy.all
Allergy Load (0.5ms) SELECT "allergies".* FROM "allergies"
=> [#<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>, #<Allergy id: 2, name: "Blah", desc: "Test", created_at: "2012-01-09 12:20:48", updated_at: "2012-01-09 12:20:48", patient_id: 2>]
1.9.2-p290 :006 > a[0]
=> #<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>
1.9.2-p290 :007 > a[0].full_name
NoMethodError: undefined method `full_name' for #<Allergy:0x1720870>
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in `method_missing'
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/attribute_methods.rb:60:in `method_missing'
from (irb):7
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:one)
@allergy.patient = patients(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:allergies)
1.9.2-p290 :001 > a = Allergy.all
Allergy Load (0.2ms) SELECT "allergies".* FROM "allergies"
=> [#<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>, #<Allergy id: 2, name: "Blah", desc: "Test", created_at: "2012-01-09 12:20:48", updated_at: "2012-01-09 12:20:48", patient_id: 2>]
1.9.2-p290 :002 > b = a[0]
=> #<Allergy id: 1, name: "Milk", desc: "Allergic to milk", created_at: "2012-01-08 16:38:55", updated_at: "2012-01-09 11:48:20", patient_id: 1>
1.9.2-p290 :003 > b.full_name
NoMethodError: undefined method `full_name' for #<Allergy:0x20429e4>
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activemodel-3.1.3/lib/active_model/attribute_methods.rb:385:in `method_missing'
from /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/attribute_methods.rb:60:in `method_missing'
from (irb):3
wenberts-MacBook-Pro-17:md wenbert$ rake test:functionals
Loaded suite /Users/wenbert/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_test_loader
Started
AllergiesControllerTest:
PASS should create allergy (0.23s)
PASS should destroy allergy (0.01s)
PASS should get edit (0.13s)
ERROR should get index (0.05s)
RuntimeError: [#<Allergy id: 298486374, name: "MyString", desc: "MyText", created_at: "2012-01-09 15:07:28", updated_at: "2012-01-09 15:07:28", patient_id: 1>]
## error
AllergiesControllerTest:
FAIL should create allergy (0.40s)
"Allergy.count" didn't change by 1.
<3> expected but was
<2>.
## test
test "should create allergy" do
assert_difference('Allergy.count') do
# GET /allergies/new
# GET /allergies/new.json
def new
@patient = Patient.find(params[:patient_id])
@allergy = @patient.allergies.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @allergy }
class AllergiesControllerTest < ActionController::TestCase
setup do
@allergy = allergies(:allergy_one)
@sample_allergy = {
:name => "allergy_name_sample",
:desc => "allergy_desc_sample",
:patient_id => @allergy.patient_id
}
end