Too many warnings about 'circular require' when run rspec

前端 未结 3 575
天命终不由人
天命终不由人 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:41

    I had same error and fixed it refs the page.

    Guard with RSpec on Rails 4 giving a lot of warnings

    the --warnings option in the .rspec file by default. Remove that line, and the warnings will go away.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-03 19:53

    It's not a fix, but removing --warnings from your .rspec file makes the warnings "go away."

    Basically, the --warnings flag puts ruby into verbose mode, which turns on alerts for a bunch of syntax issues that could potentially bite you later. Unfortunately, there's a lot of code out there (that you're probably using) that was never tested with warnings enabled. That means you're seeing a bunch of junk for code that isn't yours.

    In this case, it looks like the sass gem has issues.

    0 讨论(0)
提交回复
热议问题