Xero
Xero

Reputation: 4175

Rspec TypeError: superclass mismatch for class Cipher

I get an error when i'm trying to launch 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

and

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'

Please comment if you need more informations

Upvotes: 1

Views: 1011

Answers (1)

VAD
VAD

Reputation: 2401

About the former error. You probably are using some modern version of FactoryGirl, and now it calls FactoryBot and uses FactoryBot constant. So use FactoryBot instead of FactoryGirl

About the latter one. Maybe you have your Cipher class defined multiple times in multiple places and that's why you're getting this error. Or maybe you're trying to call it different than OpenSSL::Cipher. Any details about Cipher class could clarify the situation

Upvotes: 1

Related Questions