Rspec标记了宝石中的许多错误

时间:2014-10-19 13:19:55

标签: rspec

我想第一次设置Rspec。我已经从spec / models和spec / controllers

中删除了所有旧生成的规范

的Gemfile

group :development, :test do
  gem 'jasmine-rails'
  gem "jasmine-core", "~> 1.3"
  gem 'binding_of_caller'
  gem 'rspec-rails', '~> 3.0.0'
  gem 'factory_girl_rails'
end

group :test do
  gem "faker", "~> 1.1.2"
  gem "capybara" 
  gem "database_cleaner", "~> 1.0.1"
  gem "launchy", "~> 2.3.0"
  gem "selenium-webdriver", "~> 2.39.0"
  gem "shoulda-matchers"
end

application.rb中

config.generators do |g|
    g.test_framework :rspec,
      fixtures: true,
      view_specs: false,
      helper_specs: false,
      routing_specs: false,
      controller_specs: true,
      request_specs: false
    g.fixture_replacement :factory_girl, dir: "spec/factories"
end

我跑了rspec发电机& rake任务

bundle exec rails generate rspec:install
bundle exec rspec

我得到100个错误(价值1607行),从:

开始
/home/assay/assay/config/boot.rb:6: warning: File.exists? is a deprecated name, use  File.exist? instead
/home/assay/.rvm/gems/ruby-2.1.2@assay/gems/mysql2-0.3.16/lib/mysql2/error.rb:22: warning: method redefined; discarding old sql_state=
/home/assay/.rvm/gems/ruby-2.1.2@assay/gems/sass-3.2.19/lib/sass/version.rb:5: warning: loading in progress, circular require considered harmful - /home/assay/.rvm/gems/ruby-    2.1.2@assay/gems/sass-3.2.19/lib/sass.rb
from /home/assay/.rvm/gems/ruby-2.1.2@assay/bin/ruby_executable_hooks:15:in  `<main>'
from /home/assay/.rvm/gems/ruby-2.1.2@assay/bin/ruby_executable_hooks:15:in  `eval'
from /home/assay/.rvm/gems/ruby-2.1.2@assay/bin/rspec:23:in  `<main>'
from /home/assay/.rvm/gems/ruby-2.1.2@assay/bin/rspec:23:in  `load'
from /home/assay/.rvm/gems/ruby-2.1.2@assay/gems/rspec-core-3.0.4/exe/rspec:4:in  `<top (required)>'
from /home/assay/.rvm/gems/ruby-2.1.2@assay/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:38:in  `invoke'
from /home/assay/.rvm/gems/ruby-2.1.2@assay/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:70:in  `run'

我显然做了一件非常错事。有什么建议吗?

配置/的boot.rb

require 'rubygems'

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

1 个答案:

答案 0 :(得分:0)

我在这里找到了: Guard with RSpec on Rails 4 giving a lot of warnings

解决方案是删除 .rspec

中的警告行

我看到的问题是应用程序中的警告现在丢失了,因为gems中的警告被抑制了。