Method: RWebSpec::DatabaseChecker#load_table
- Defined in:
- lib/rwebspec-common/database_checker.rb
#load_table(table_name) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rwebspec-common/database_checker.rb', line 58 def load_table(table_name) begin ActiveRecord::Base.connection rescue =>e raise "No database connection setup yet, use connect_to_database() method" end class_name = table_name.classify # define the class, so can use ActiveRecord in # such as # Perosn.count.should == 2 def_class = "class ::#{class_name} < ActiveRecord::Base; end" eval def_class return def_class end |