2013-04-12 1 views
3

레일 4 앱에 대한 몇 가지 테스트를 완료하려고하는데 database_cleaner 문제가 계속 발생합니다. 문제는 데이터베이스가 청소되지 않을이며 경고가 제기 유지 :레일 4 데이터베이스 클리너

DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
.DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
WARNING: there is already a transaction in progress 
WARNING: there is already a transaction in progress 
.FFFFDEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
.DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
WARNING: there is already a transaction in progress 
.DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
WARNING: there is already a transaction in progress 
.WARNING: there is already a transaction in progress 
DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
.DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
WARNING: there is already a transaction in progress 
.DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
WARNING: there is already a transaction in progress 
.DEPRECATION WARNING: #increment_open_transactions is deprecated and has no effect. (called from block (3 levels) in <top (required)> at /Users/davidhahn/Dev/cta-projects/user-management2/spec/spec_helper.rb:49) 
WARNING: there is already a transaction in progress 
WARNING: there is already a transaction in progress 

내가 가진 구성을 사양 도우미의 설정은 다음과 같습니다 내 gemfile

require 'rubygems' 
require 'spork' 
#uncomment the following line to use spork with the debugger 
#require 'spork/ext/ruby-debug' 

Spork.prefork do 
    # Loading more in this block will cause your tests to run faster. However, 
    # if you change any configuration or code from libraries loaded here, you'll 
    # need to restart spork for it take effect. 

    # This file is copied to spec/ when you run 'rails generate rspec:install' 
    ENV["RAILS_ENV"] ||= 'test' 
    require File.expand_path("../../config/environment", __FILE__) 
    # require 'rspec/rails' 
    require 'rspec/autorun' 
    require 'capybara/rspec' 
    require 'database_cleaner' 

    # Requires supporting ruby files with custom matchers and macros, etc, 
    # in spec/support/ and its subdirectories. 
    Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} 

    RSpec.configure do |config| 
    # ## Mock Framework 
    # 
    # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: 
    # 
    # config.mock_with :mocha 
    # config.mock_with :flexmock 
    # config.mock_with :rr 
    config.mock_with :rspec 

    # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 
    # config.fixture_path = "#{::Rails.root}/spec/fixtures" 
    config.filter_run focus: true 
    config.run_all_when_everything_filtered = true 

    # If you're not using ActiveRecord, or you'd prefer not to run each of your 
    # examples within a transaction, remove the following line or assign false 
    # instead of true. 
    # config.use_transactional_fixtures = false 

    config.before :each do 
    if Capybara.current_driver == :rack_test 
     DatabaseCleaner.strategy = :transaction 
    else 
     DatabaseCleaner.strategy = :truncation 
    end 
    DatabaseCleaner.start 
    end 

    config.after do 
    DatabaseCleaner.clean 
    end 


    # If true, the base class of anonymous controllers will be inferred 
    # automatically. This will be the default behavior in future versions of 
    # rspec-rails. 
    # config.infer_base_class_for_anonymous_controllers = false 

    # Run specs in random order to surface order dependencies. If you find an 
    # order dependency and want to debug it, you can fix the order by providing 
    # the seed, which is printed after each run. 
    #  --seed 1234 
    config.order = "random" 
    end 
end 

그리고 마지막으로 여기에

source 'https://rubygems.org' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.0.0.beta1' 

gem 'pg' 
gem 'haml-rails', '~> 0.4' 
gem 'twitter-bootstrap-rails', '~> 2.2.0' 
gem 'annotate', '~> 2.5.0' 
group :test do 
    gem 'rspec', '~> 2.13.0' 
    gem 'rspec-rails', '~> 2.13.0' 
    gem 'guard-rspec', '~> 1.2.1' 
    gem 'guard-spork', '~> 1.4.2' 
    gem 'capybara', '~> 2.0.2' 
    gem 'spork', '~> 0.9.2' 
    gem 'factory_girl_rails', '~> 4.1.0' 
    gem 'shoulda-matchers', '~> 1.4.2' 
    gem 'database_cleaner', '~> 0.9.1' 
    gem 'launchy', '~> 2.2.0' 
    gem 'rb-fsevent', '~> 0.9.2' 
    gem 'growl', '~> 1.0.3' 
end 

group :development do 
    gem 'better_errors' ,'~> 0.6.0' 
    gem 'binding_of_caller', '~> 0.7.1' 
end 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 4.0.0.beta1' 
    gem 'coffee-rails', '~> 4.0.0.beta1' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer', platforms: :ruby 

    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 1.0.1' 

이 문제에 대한 도움이 도움이 될 것입니다. 고맙습니다!

답변

11

database_cleaner의 1.0.0 RC1 릴리스에서 수정 된 것처럼 보입니다. 당신의 Gemfile에서 이것을보십시오 :

gem "database_cleaner", '1.0.0.RC1' 
+0

굉장! 그것은 매력처럼 작동했습니다! –