1
相似名稱的測試加載夾具我有3個班,STI,我想加載夾具每個:Rails的不與STI
Employee
Admin < Employee
OtherEmployee < Employee
我test_helper檔案有fixtures :all
和夾具在:
employees.yml
admins.yml
other_employees.yml
,但只從other_employees.yml
數據被加載到數據庫中。任何想法爲什麼或如何解決這個問題?
燈具:
#employees.yml
one:
id: 1
name: Name1
full_name: FName1
type: Admin
two:
name: Name2
full_name: FName2
type: Admin
three:
name: Name3
full_name: FName3
type: OtherEmployee
#admins.yml
adminone:
name: Admin1
full_name: FAdmin1
type: Admin
admintwo:
name: Admin2
full_name: FAdmin2
type: Admin
#other_employees.yml
oeone:
name: Oemp1
full_name: FOemp1
type: OtherEmployee
oetwo:
name: Oemp2
full_name: FOemp2
type: OtherEmployee
我正在使用rails 4.2.6。如果我像上面那樣嘗試,數據庫似乎只需要1個文件。具體而言,以後按字母順序排列,這可能是一條線索。 – akoller
你可以發佈你的夾具文件的樣子嗎? – kcdragon
完成。讓我知道這是否有幫助。 – akoller