Sha256: 2808615a3f5a1057b11b9c1587fcfcdd6ccdf39ba9256e35d9a8b66dab047658
Contents?: true
Size: 855 Bytes
Versions: 9
Compression:
Stored size: 855 Bytes
Contents
ENV['RAILS_ENV'] ||= 'test' require_relative "../config/environment" require "rails/test_help" class ActiveSupport::TestCase # Run tests in parallel with specified workers parallelize(workers: :number_of_processors) # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all def assert_queries(expected_count) ActiveRecord::Base.connection.materialize_transactions queries = [] ActiveSupport::Notifications.subscribe("sql.active_record") do |*, payload| queries << payload[:sql] unless %w[ SCHEMA TRANSACTION ].include?(payload[:name]) end yield.tap do assert_equal expected_count, queries.size, "#{queries.size} instead of #{expected_count} queries were executed. #{queries.inspect}" end end def assert_no_queries(&block) assert_queries(0, &block) end end
Version data entries
9 entries across 9 versions & 1 rubygems