I have 3 questions:
-
What is the default testing library that comes with Rails? I can't actually see what it's called... MiniTest? TestUnit?
-
How can I make some code run once per TestCase to setup for ALL tests. It seems
setup dois run before each test, but I want to set up for the entire file. -
How come my example below doesn't work (it won't clear out and re-create the seed data before each test)
Code:
require 'test_helper'
# negative numbers
# 3+ line item journal entries
class LedgerTest < ActiveSupport::TestCase
setup do
ActiveRecord::Base.subclasses.each(&:delete_all)
AccountType.create!(code: 101, name: 'Cash', category: :asset, normal_balance: :debit)
AccountType.create!(code: 102, name: 'Equipment', category: :asset, normal_balance: :debit)
AccountType.create!(code: 103, name: 'Accumulated Depreciation', category: :asset, normal_balance: :credit, contra: true)
end
test "test 1 here" do
end
test "test 2 here" do
end
end
Aucun commentaire:
Enregistrer un commentaire