【发布时间】:2017-08-21 10:33:04
【问题描述】:
我正在尝试为具有belongs_to 关联的类创建一些关联测试。
在创建固定装置时测试失败 - Rails 未检测到 Posts 中的 belongs_to :user 关联。
它似乎传递了常规的rake test 命令,但不是当单个文件在guard 中运行时。
测试如下:
module Post
class AssociationsTest < ActiveSupport::TestCase
subject { Post.new }
should belong_to(:user)
end
end
【问题讨论】:
标签: ruby-on-rails activerecord guard belongs-to