Skip to content

Instantly share code, notes, and snippets.

@gabeodess
Created November 5, 2010 14:46
Show Gist options
  • Save gabeodess/664239 to your computer and use it in GitHub Desktop.
Save gabeodess/664239 to your computer and use it in GitHub Desktop.
## Models
class Bank < ActiveRecord::Base
using_access_control
has_many :bank_accounts
has_many :bank_statements
validates_presence_of :name
end
class BankAccount < ActiveRecord::Base
using_access_control
belongs_to :bank, :validate => true, :autosave => true
accepts_nested_attributes_for :bank
validates_presence_of :bank, :name
has_many :bank_statements
def number=(number)
self.name = number
end
def number
self.name
end
end
## test
require 'test_helper'
class BankAccountTest < ActiveSupport::TestCase
fixtures :all
# Replace this with your real tests.
test "the truth" do
assert true
end
end
##what happens
gabeodess@Macintosh-253:~/Sites/just_4_the_board master$rake db:schema:load RAILS_ENV=test
(in /Users/gabeodess/Sites/just_4_the_board)
-- create_table("addresses", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "addresses_id_seq" for serial column "addresses.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "addresses_pkey" for table "addresses"
-> 0.0220s
-- create_table("bank_accounts", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "bank_accounts_id_seq" for serial column "bank_accounts.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "bank_accounts_pkey" for table "bank_accounts"
-> 0.0115s
-- create_table("bank_statements_data", {:primary_key=>"bank_statement_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "bank_statements_data_bank_statement_id_seq" for serial column "bank_statements_data.bank_statement_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "bank_statements_data_pkey" for table "bank_statements_data"
-> 0.0154s
-- create_table("banks", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "banks_id_seq" for serial column "banks.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "banks_pkey" for table "banks"
-> 0.0088s
-- create_table("board_members_data", {:primary_key=>"board_member_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "board_members_data_board_member_id_seq" for serial column "board_members_data.board_member_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "board_members_data_pkey" for table "board_members_data"
-> 0.0111s
-- add_index("board_members_data", ["login"], {:name=>"index_board_members_data_on_login", :unique=>true})
-> 0.0037s
-- create_table("board_members_events", {:force=>true, :id=>false})
-> 0.0080s
-- create_table("board_members_roles", {:force=>true, :id=>false})
-> 0.0050s
-- create_table("buildings", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "buildings_id_seq" for serial column "buildings.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "buildings_pkey" for table "buildings"
-> 0.0102s
-- add_index("buildings", ["access_token"], {:name=>"index_buildings_on_access_token", :unique=>true})
-> 0.0032s
-- create_table("buildings_addresses", {:force=>true, :id=>false})
-> 0.0044s
-- create_table("buildings_users", {:force=>true, :id=>false})
-> 0.0047s
-- create_table("cases", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "cases_id_seq" for serial column "cases.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "cases_pkey" for table "cases"
-> 0.0140s
-- add_index("cases", ["name"], {:name=>"index_cases_on_name", :unique=>true})
-> 0.0031s
-- create_table("class_table_inheritance", {:primary_key=>"parent_relation", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "class_table_inheritance_parent_relation_seq" for serial column "class_table_inheritance.parent_relation"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "class_table_inheritance_pkey" for table "class_table_inheritance"
-> 0.0113s
-- add_index("class_table_inheritance", ["child_aggregate_view", "parent_relation"], {:name=>"class_table_inheritance_parent_relation_key", :unique=>true})
-> 0.0031s
-- add_index("class_table_inheritance", ["child_aggregate_view"], {:name=>"class_table_inheritance_child_aggregate_view_key", :unique=>true})
-> 0.0035s
-- create_table("countries", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "countries_id_seq" for serial column "countries.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "countries_pkey" for table "countries"
-> 0.0094s
-- create_table("documents", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "documents_id_seq" for serial column "documents.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "documents_pkey" for table "documents"
-> 0.0203s
-- create_table("events", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "events_id_seq" for serial column "events.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "events_pkey" for table "events"
-> 0.0142s
-- add_index("events", ["end_timestamp"], {:name=>"index_events_on_end_timestamp"})
-> 0.0044s
-- add_index("events", ["start_timestamp"], {:name=>"index_events_on_start_timestamp"})
-> 0.0028s
-- create_table("expenses_data", {:primary_key=>"expense_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "expenses_data_expense_id_seq" for serial column "expenses_data.expense_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "expenses_data_pkey" for table "expenses_data"
-> 0.0128s
-- create_table("feedback", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "feedback_id_seq" for serial column "feedback.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "feedback_pkey" for table "feedback"
-> 0.0130s
-- create_table("folders", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "folders_id_seq" for serial column "folders.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "folders_pkey" for table "folders"
-> 0.0133s
-- create_table("litigations_data", {:primary_key=>"litigation_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "litigations_data_litigation_id_seq" for serial column "litigations_data.litigation_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "litigations_data_pkey" for table "litigations_data"
-> 0.0149s
-- create_table("others_data", {:primary_key=>"other_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "others_data_other_id_seq" for serial column "others_data.other_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "others_data_pkey" for table "others_data"
-> 0.0092s
-- create_table("roles", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "roles_id_seq" for serial column "roles.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "roles_pkey" for table "roles"
-> 0.0104s
-- create_table("shareholders_data", {:primary_key=>"shareholder_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "shareholders_data_shareholder_id_seq" for serial column "shareholders_data.shareholder_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "shareholders_data_pkey" for table "shareholders_data"
-> 0.0088s
-- create_table("staff_data", {:primary_key=>"staff_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "staff_data_staff_id_seq" for serial column "staff_data.staff_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "staff_data_pkey" for table "staff_data"
-> 0.0152s
-- create_table("states", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "states_id_seq" for serial column "states.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "states_pkey" for table "states"
-> 0.0106s
-- create_table("superintendents_data", {:primary_key=>"superintendent_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "superintendents_data_superintendent_id_seq" for serial column "superintendents_data.superintendent_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "superintendents_data_pkey" for table "superintendents_data"
-> 0.0115s
-- create_table("tenants_data", {:primary_key=>"tenant_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "tenants_data_tenant_id_seq" for serial column "tenants_data.tenant_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tenants_data_pkey" for table "tenants_data"
-> 0.0117s
-- create_table("users", {:force=>true})
NOTICE: CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"
-> 0.0149s
-- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})
-> 0.0035s
-- create_table("vendors_data", {:primary_key=>"vendor_id", :force=>true})
NOTICE: CREATE TABLE will create implicit sequence "vendors_data_vendor_id_seq" for serial column "vendors_data.vendor_id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "vendors_data_pkey" for table "vendors_data"
-> 0.0097s
-- initialize_schema_migrations_table()
-> 0.0152s
-- assume_migrated_upto_version(20090810171059)
-> 0.0181s
gabeodess@Macintosh-253:~/Sites/just_4_the_board master$rake test
(in /Users/gabeodess/Sites/just_4_the_board)
sh: pg_dump: command not found
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:1: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:3: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:5: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:7: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:9: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:11: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:13: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:15: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:17: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:19: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:21: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:23: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:25: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:27: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:29: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:31: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:33: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:35: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:37: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:37: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:39: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:41: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:43: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:45: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:47: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:49: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:51: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:53: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:55: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:57: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:59: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:61: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:63: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:65: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:67: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:69: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:71: ERROR: relation "schema_migrations" does not exist
psql:/Users/gabeodess/Sites/just_4_the_board/db/development_structure.sql:73: ERROR: relation "schema_migrations" does not exist
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/bank_account_test.rb" "test/unit/helpers/bank_accounts_helper_test.rb"
/Library/Ruby/Gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:50: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/board_members_controller.rb:9: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/folders_controller.rb:27: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/folders_controller.rb:33: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/folders_controller.rb:41: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/shareholders_controller.rb:6: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/staffs_controller.rb:3: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/superintendents_controller.rb:3: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/tenants_controller.rb:6: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/vendors_controller.rb:3: warning: parenthesize argument(s) for future version
Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
E
Finished in 0.01184 seconds.
1) Error:
test_the_truth(BankAccountTest):
ActiveRecord::StatementInvalid: PGError: ERROR: relation "bank_accounts" does not exist
: DELETE FROM "bank_accounts"
1 tests, 0 assertions, 0 failures, 1 errors
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/functional/bank_accounts_controller_test.rb"
/Library/Ruby/Gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:50: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/board_members_controller.rb:9: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/folders_controller.rb:27: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/folders_controller.rb:33: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/folders_controller.rb:41: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/shareholders_controller.rb:6: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/staffs_controller.rb:3: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/superintendents_controller.rb:3: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/tenants_controller.rb:6: warning: parenthesize argument(s) for future version
/Users/gabeodess/Sites/just_4_the_board/app/controllers/vendors_controller.rb:3: warning: parenthesize argument(s) for future version
Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
E
Finished in 0.010871 seconds.
1) Error:
test_should_get_index(BankAccountsControllerTest):
ActiveRecord::StatementInvalid: PGError: ERROR: relation "bank_accounts" does not exist
: DELETE FROM "bank_accounts"
1 tests, 0 assertions, 0 failures, 1 errors
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
Errors running test:units and test:functionals!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment