当我试图启动rspec时出现错误:
An error occurred while loading ./spec/factories_spec.rb.
Failure/Error:
FactoryGirl.factories.map(&:name).each do |factory_name|
describe "The #{factory_name} factory" do
it 'is valid' do
build(factory_name).should be_valid
end
end
end
NameError:
uninitialized constant FactoryGirl
# ./spec/factories_spec.rb:1:in `<top (required)>'
/usr/lib/x86_64-linux-gnu/ruby/2.4.0/openssl.so: warning: already initialized constant OpenSSL::VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.4.0/openssl.so: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/usr/lib/x86_64-linux-gnu/ruby/2.4.0/openssl.so: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
和
An error occurred while loading ./spec/helpers/date_helper_spec.rb.
Failure/Error: require File.expand_path('../../config/environment', __FILE__)
TypeError:
superclass mismatch for class Cipher
# /var/lib/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support.rb:24:in `require'
如果您需要更多信息,请发表评论
答案 0 :(得分:1)
关于前一个错误。您可能正在使用一些现代版本的FactoryGirl,现在它调用FactoryBot并使用FactoryBot
常量。因此,请使用FactoryBot
代替FactoryGirl
关于后者。也许您已经在多个地方多次定义了Cipher
课程,这就是您收到此错误的原因。或者您可能尝试将其称为与OpenSSL::Cipher
不同。有关Cipher
课程的任何详细信息都可以澄清情况