我正在开发一个Rails项目,我正在使用FactoryGirl,Faker和DatabaseCleaner设置RSpec。到目前为止,这是我的Gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0'
gem 'jquery-rails'
gem 'haml', '~> 4.0'
gem 'devise', '~> 3.2'
gem 'jbuilder', '~> 2.0'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'lograge'
gem 'pry-rails'
end
group :test do
gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails'
gem 'faker'
end
gem 'sdoc', '~> 0.4', group: :doc
gem 'spring', group: :development
gem 'rails_12factor', group: :production
这是我的spec/rails_helper.rb
:
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
end
现在,当我通过bin/rspec
可执行文件运行规范时,我得到了这个mixture of warnings and errors(由于StackOverflow的字符限制,我不得不把它放在Gist中)。此外,我的log/test.log
文件中似乎记录了一些数据库警告also in a Gist。
如果你看起来正确,我写的一个规范(创建一个新的Organisation
工厂)实际上已经过了。当$VERBOSE = nil
警告和错误没有出现时,我得到的是:
.
Finished in 0.35145 seconds (files took 1.61 seconds to load)
1 example, 0 failures
我似乎无法弄清楚警告的意思,我想知道你是否知道如何修理/摆脱它们?