Getting an error when I try to test my model called Settings, I have a feeling it has something to do with singular and plural model names, but how do I fix it?
here is the spec 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)>'
My model is truly named Settings, the file name is settings.rb. Thanks!
It expects model name to be Setting. Either rename model app/model/setting.rb to Setting or goto the file config/initializers/inflections.rb and add settings to uncountable configuration.
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable %w(settings)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With