This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class AllergiesControllerTest < ActionController::TestCase | |
setup do | |
@allergy = allergies(:one) | |
end | |
test "should get index" do | |
get :index | |
assert_response :success |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |