2018-02-24 01:34:15 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-01 12:08:48 -04:00
|
|
|
require "active_support"
|
2018-02-24 01:45:50 -05:00
|
|
|
require "minitest/autorun"
|
|
|
|
require "arel"
|
|
|
|
|
|
|
|
require_relative "support/fake_record"
|
2018-02-24 01:34:15 -05:00
|
|
|
|
2019-10-04 04:16:33 -04:00
|
|
|
Minitest::Expectation.class_eval do
|
2018-02-24 01:45:50 -05:00
|
|
|
def must_be_like(other)
|
2019-10-04 04:16:33 -04:00
|
|
|
self.class.new(target.gsub(/\s+/, " ").strip, ctx).must_equal other.gsub(/\s+/, " ").strip
|
2018-02-24 01:34:15 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
module Arel
|
2018-04-25 06:29:58 -04:00
|
|
|
class Test < ActiveSupport::TestCase
|
2018-02-24 01:34:15 -05:00
|
|
|
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
|
2018-04-25 06:29:58 -04:00
|
|
|
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
|
2018-02-24 01:34:15 -05:00
|
|
|
end
|
|
|
|
end
|