当我尝试测试名为“设置”的模型时出现错误,我感觉它与单数和复数模型名称有关,但我该如何解决呢?
这是规范 settings_spec.rb:
require 'spec_helper'
describe Settings do
let!(:settings) { Factory(:settings) }
describe "has a valid factory" do
specify { should be_an_instance_of(Settings) }
end
end
1) Settings has a valid factory
Failure/Error: let!(:settings) { Factory(:settings) }
NameError:
uninitialized constant Setting
# ./spec/models/settings_spec.rb:4:in `block (2 levels) in <top (required)>'
我的模型真正命名为Settings,文件名为settings.rb。谢谢!