Chris Olsen wrote: > That is the problem, which is clear now that I tested it with the > script/console in test mode rather than development. > > So now the question is, why does the data not exist in the test > database. The country and province data inserts exist within the > migration files, ex for countries: > > class CreateCountries < ActiveRecord::Migration > def self.up > create_table :countries do |t| > t.column :country_id, :integer > t.column :name2, :string, :limit => 2 > t.column :name3, :string, :limit => 3 > t.column :name, :string > t.column :district_name, :string > t.column :code_name, :string > t.column :strength, :integer > end > > country_data = [ > [124, 'CA', 'CAN', 'Canada', 'Province', 'Postal Code', 100], > [840, 'US', 'USA', 'United States', 'State', 'ZipCode', 50], > #along with many other countries > ].each do |c| > > insert_params = { > :country_id => c[0], > :name2 => c[1], > :name3 => c[2], > :name => c[3], > :district_name => c[4], > :code_name => c[5], > :strength => c[6] > } > > Country.create(insert_params) > end > end > > Thanks for the help.
I should mention that the test database is cloned properly with the script: task :reset_databases do system "mysqladmin -u root drop MyDB_development" system "mysqladmin -u root drop MyDB_test" system "mysqladmin -u root create MyDB_development" system "mysqladmin -u root create MyDB_test" system "rake db:migrate" system "rake db:test:clone_structure" end script/console test >> Country.find(:all) => [] -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users