LoginSignup
9
8

More than 5 years have passed since last update.

Rspec の warning を消す

Posted at

問題

次のようにWarningがたくさんでて邪魔なので消すには。。。

$ bundle exec rspec
|| /Users/user/work/rails/testapp2/vendor/bundle/ruby/2.1.0/gems/mysql2-0.3.16/lib/mysql2/error.rb:22: warning: method redefined; discarding old sql_state=
|| /Users/user/work/rails/testapp2/vendor/bundle/ruby/2.1.0/gems/sass-3.2.19/lib/sass/version.rb:5: warning: loading in progress, circular require considered harmful - /User
...

解決方法

[app_root]/.rspec の --warnings を削除するだけ。

ただし、Rubyの警告は全て出力されなくなる。

参照

Rails4 の RSpec でたくさんエラーがでる
http://stackoverflow.com/questions/24003316/guard-with-rspec-on-rails-4-giving-a-lot-of-warnings

Spec 実行時に Rubyのwarning を止めるには
http://stackoverflow.com/questions/5591509/suppress-ruby-warnings-when-running-specs

RSpec で Warnings をテストするには
http://stackoverflow.com/questions/5449187/test-for-warnings-using-rspec

stderr をフックして出力してしまうらしい

9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8