1

尝试启动 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'

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

4

1 回答 1

1

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

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

于 2018-01-18T08:50:38.133 回答