blob: b716ee833f19da33ee2cfc67912a14daf63790eb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# frozen_string_literal: true
require 'rubygems'
require 'minitest/autorun'
require 'arel'
require_relative 'support/fake_record'
class Object
def must_be_like other
gsub(/\s+/, ' ').strip.must_equal other.gsub(/\s+/, ' ').strip
end
end
module Arel
class Test < Minitest::Test
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
def assert_like expected, actual
assert_equal expected.gsub(/\s+/, ' ').strip,
actual.gsub(/\s+/, ' ').strip
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
end
end
|