0
我有两个模型之间有一个关系。这种关系是有效的,但问题是当我用shoulda匹配器写一个Rspec测试时,我返回一个错误。Rails有一个Rspec测试告诉我Unitialized Constant
Failure/Error: it { should have_one(:userresetpassword)}
NameError:
uninitialized constant User::Userresetpassword
我在user.rb
has_one :userresetpassword
代码我的RSpec的测试
describe "associations" do
it { should have_one(:userresetpassword)}
end
'require'spec_helper''在spec文件中。为了简洁,我省略了它。 – jason328
它看起来应该或rails不知道你想要的类名是什么,该协会的类名是什么?你的关联名称会表明它是'Userresetpassword'。 –
关闭,它是'UserResetPassword'。 – jason328