test/table_test.rb in rails_db-0.8 vs test/table_test.rb in rails_db-0.9
- old
+ new
@@ -6,11 +6,11 @@
clean_db
@users_table = RailsDb::Table.new('users')
end
test 'columns' do
- assert_equal @users_table.column_names, ["id", "name", "age", "salary", "bio", "created_at", "updated_at", "account_id", "dob"]
+ assert_equal @users_table.column_names, ["id", "name", "age", "salary", "bio", "created_at", "updated_at", "account_id", "dob", "active"]
end
test 'to_csv' do
User.create(name: 'igor')
assert_not_equal @users_table.to_csv, ''
@@ -37,8 +37,16 @@
assert_equal 2, User.count
@users_table.delete(user_1.id)
assert_equal 1, User.count
assert_equal 0, User.where(name: 'igor').count
assert_equal 1, User.where(name: 'john').count
+ end
+
+ test 'as_table' do
+ User.delete_all
+ user_1 = User.create(name: 'igor')
+
+ klass = @users_table.as_model
+ assert_equal 'igor', klass.first.name
end
end
\ No newline at end of file