Rspec TypeError: superclass mismatch for class Cipher

Rspec TypeError: superclass mismatch for class Cipher

我在尝试启动时遇到错误 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'

如果您需要更多信息,请发表评论

关于之前的错误。你可能正在使用一些现代版本的 FactoryGirl,现在它调用 FactoryBot 并使用 FactoryBot 常量。所以使用 FactoryBot 而不是 FactoryGirl

关于后一个。也许您在多个地方多次定义了 Cipher class,这就是您收到此错误的原因。或者,也许您正在尝试将其称为不同于 OpenSSL::Cipher。关于 Cipher class 的任何细节都可以澄清情况