1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/cases/arel/helper.rb
Ryuta Kamizono 6158b83d2a Address to the warning "DEPRECATED: global use of assertion methods"
This addresses to the warning "DEPRECATED: global use of assertion
methods" which is introduced in minitest v5.12.0.

e6bc448573

https://buildkite.com/rails/rails/builds/64121#880aecf2-849f-4603-95f1-228784c7d3f4/1003-1010
2019-10-04 17:32:31 +09:00

45 lines
1 KiB
Ruby

# frozen_string_literal: true
require "active_support"
require "minitest/autorun"
require "arel"
require_relative "support/fake_record"
Minitest::Expectation.class_eval do
def must_be_like(other)
self.class.new(target.gsub(/\s+/, " ").strip, ctx).must_equal other.gsub(/\s+/, " ").strip
end
end
module Arel
class Test < ActiveSupport::TestCase
def setup
super
@arel_engine = Arel::Table.engine
Arel::Table.engine = FakeRecord::Base.new
end
def teardown
Arel::Table.engine = @arel_engine if defined? @arel_engine
super
end
end
class Spec < Minitest::Spec
before do
@arel_engine = Arel::Table.engine
Arel::Table.engine = FakeRecord::Base.new
end
after do
Arel::Table.engine = @arel_engine if defined? @arel_engine
end
include ActiveSupport::Testing::Assertions
# test/unit backwards compatibility methods
alias :assert_no_match :refute_match
alias :assert_not_equal :refute_equal
alias :assert_not_same :refute_same
end
end