My problems:
- The client database is located in the machine through the VPN, so my tests are very slow (about 30-40 seconds each)
- This database is not completely suitable for my application, and my data is associated with data that was already in the database
- Composite primary keys are present in old database tables, and informix adapter does not support it for fixtures
What I use:
- Ruby on Rails 4.2.5
- Jruby 9.0.1.0
- Informix Database Through JDBC Connection
- Minitest
- MiniTest-o
What i have done so far:
- Testing time was reduced after 5-10 seconds with
Devise.stretches = 1and configurations Rails.logger.level = 4. - fixture , , , , , . , .
- , , (
self.use_transactional_fixtures = false), , , . reset " " , , , , , . " ", :
class ActiveRecord::FixtureSet
class << self
alias :orig_create_fixtures :create_fixtures
end
def self.create_fixtures f_dir, fs_names, *args
reset_cache
People.delete_all
orig_create_fixtures f_dir, fs_names, *args
end
end
delete_all .
, , 8 .
:
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require "rails/test_help"
require 'minitest/autorun'
require 'minitest/reporters'
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
ActiveSupport::TestCase.class_eval do
extend MiniTest::Spec::DSL
fixtures :all
self.use_transactional_fixtures = false
Devise.stretches = 1
Rails.logger.level = 4
reporter_options = {color: true, slow_count: 5}
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(reporter_options)]
end
- ? ? ?