Rspec 在STI模型上运行我的规范时,获取Active::Record::Statement无效

Rspec 在STI模型上运行我的规范时,获取Active::Record::Statement无效,rspec,ruby-on-rails-3.2,fixtures,sti,Rspec,Ruby On Rails 3.2,Fixtures,Sti,所以,这是我的问题。我有一个叫AdminNotifications的模型。它属于AdminUser模型。有一个使用STI从AdminNotification继承的QuorumAdminNotification模型。它当前为空。当我运行我的规范时,我在所有测试中都会遇到此错误: (“法定人数”、“已达到”、“已达到法定人数”、“管理员”、“2012-08-28 14:50:43',2012-08-28 14:50:43',853808134) 如果我将继承列设置为不存在的列,则所有测试都会通过 有

所以,这是我的问题。我有一个叫AdminNotifications的模型。它属于AdminUser模型。有一个使用STI从AdminNotification继承的QuorumAdminNotification模型。它当前为空。当我运行我的规范时,我在所有测试中都会遇到此错误:

(“法定人数”、“已达到”、“已达到法定人数”、“管理员”、“2012-08-28 14:50:43',2012-08-28 14:50:43',853808134)

如果我将继承列设置为不存在的列,则所有测试都会通过

有人知道为什么会这样吗

以下是相关代码:

app/models/admin_notification.rb

class AdminNotification < ActiveRecord::Base
  belongs_to :admin_user

  attr_accessible :message, :model, :record_id, :type

  scope :addressed, where('admin_user_id IS NOT NULL')
  scope :unaddressed, where('admin_user_id IS NULL')

  def addressed?
    !admin_user.nil?
  end
end
规格/装置/管理通知.yml

unaddressed1:
  type: Quorum
  event: reached 
  message: "Quorum has been reached"

unaddressed2:
  type: Quorum
  event: test 
  message: "Test message"

addressed1:
  type: Quorum
  event: reached 
  message: "Quorum has been reached"
  admin_user: admin

addressed2:
  type: Quorum
  event: reached 
  message: "Quorum has been reached"
  admin_user: admin
app/spec/admin_users.yml

admin:
  email: admin@example.com
  password: password
  password_confirmation: password
谢谢

修复了它

问题在于fixture中的type字段

应该是

QuorumAdminNotification

不是

法定人数

unaddressed1:
  type: Quorum
  event: reached 
  message: "Quorum has been reached"

unaddressed2:
  type: Quorum
  event: test 
  message: "Test message"

addressed1:
  type: Quorum
  event: reached 
  message: "Quorum has been reached"
  admin_user: admin

addressed2:
  type: Quorum
  event: reached 
  message: "Quorum has been reached"
  admin_user: admin
admin:
  email: admin@example.com
  password: password
  password_confirmation: password