我似乎无法使ActiveSupport :: Testing中的Pending模块工作.
test/unit/pending.rb包含:
require 'test_helper'
require 'active_support/testing/pending'
class PendingTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Pending
pending "a pending case with a closure" do
assert false
end
end
Run Code Online (Sandbox Code Playgroud)
但是当我执行ruby unit/foo.rb时,我得到:
undefined method `pending' for PendingTest:Class (NoMethodError)
Run Code Online (Sandbox Code Playgroud)
我查看了ActiveSupport gem中pending.rb中的代码.挂起的方法在除非定义的?(Spec)块之内,但我确认未定义Spec.
提前致谢...
我创造了一个班级; 下面是班级
Class distanceChart{
Vehicle v1;
Vehicle v2;
static contstraints = {
v1(nullable:true)
v2(nullable:true)
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行应用程序时,表distance_chart用v1_id(null:no),v2_id(null:no)创建,当我尝试保存而不进入车辆时,我收到一条错误消息:
"请输入vehicle1""请输入vehicle2"
我没有遇到问题.即使我已将约束指定为null,为什么它不接受空值.任何人都可以帮助我解决问题.