Too many warnings about 'circular require' when run rspec

前端 未结 3 576
天命终不由人
天命终不由人 2021-01-03 19:24

Hi I got lots of warning when run rspec which does annoying me too much,

How to fix it ? because I\'ve tried the Ruby version 2.1.2 under

3条回答
  •  温柔的废话
    2021-01-03 19:47

    These are warnings emitted by rspec because of a circular dependency. Likely this is a mix of require statements that are no longer correct. (I believe as of RSpec 3.0.)

    If this is a Rails app:

    1. If your project is so old that you don't have a rails_helper.rb, you should use the rails g rspec:install to set this up. rails_helper.rb requires spec_helper, and it contains things that are specific to Rails.
    2. Make sure that your .rspec file includes --require 'rails_helper' and that it is checked in to source control.
    3. Remove any require 'spec_helper' or require 'rails_helper' from the top of any spec files.

    If this is not a Rails app:

    1. Make sure that your .rspec file includes --require 'spec_helper' and that it is checked in to source control.
    2. Remove any require 'spec_helper' from the top of any spec files.

    This will ensure that the dependencies are only loaded once, regardless of whether you run rspec on a specific file or for all of them.

提交回复
热议问题