Ruby on rails Rspec工厂女孩模型单数复数(未初始化常量[ModelName])

Ruby on rails Rspec工厂女孩模型单数复数(未初始化常量[ModelName]),ruby-on-rails,ruby,rspec,Ruby On Rails,Ruby,Rspec,当我尝试测试名为“设置”的模型时出错,我感觉它与单数和复数模型名有关,但如何修复它 以下是等级库设置\u 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)

当我尝试测试名为“设置”的模型时出错,我感觉它与单数和复数模型名有关,但如何修复它

以下是等级库设置\u 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)>'
require'spec\u helper'
请描述您所做的设置
让我来!(:设置){工厂(:设置)}
描述“有一个有效的工厂”吗
指定{应该是(设置)的一个实例}
结束
结束
1) 设置具有有效的出厂设置
失败/错误:让我来!(:设置){工厂(:设置)}
名称错误:
未初始化常数设置
#./spec/models/settings_spec.rb:4:in“block(2层)in”

我的模型名为Settings,文件名为Settings.rb。谢谢

它希望型号名称为
设置
。将model
app/model/setting.rb
重命名为
setting
,或者转到文件
config/initializers/deconctions.rb
并将设置添加到不可数配置中

ActiveSupport::Inflector.inflections do |inflect|
  inflect.uncountable %w(settings)
end

我只是好奇,你是否能马上知道这是否会在我的应用程序的其他地方产生副作用?