我已經看過rails guide to testing,但我似乎可以從我的測試中獲取夾具數據。我有一個夾具:鐵軌 - 如何從測試中抓取夾具數據
one:
pay_period: one
employee: kent
cpp: 50
ei: 40
tax: 100
vacation_pay: 30
然後我有一個測試按照以下(其中EmployeePayPeriod是一個模型)
require 'test_helper'
class EmployeePayPeriodTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "Calculate wages under 80 hours correctly" do
p = EmployeePayPeriod(:one)
assert true
end
end
顯然高於不工作。我看過指南。在引導它使用的代碼片段來說明你如何讓燈具數據:
@user = users(:david).
看來,「用戶」不是模型(因爲通常慣例是,它會單數和大寫那麼,這是否。 「用戶」是從哪裏來的?如果它的自動生成應該有相當的「employee_pay_periods」我對象可用?(我嘗試過,但似乎並沒有工作)。
感謝
我的榮幸。祝你好運。 – theIV 2009-08-27 05:50:33