forked from thoughtbot/shoulda-matchers
/
active_record_versions.rb
62 lines (48 loc) · 1.43 KB
/
active_record_versions.rb
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module UnitTests
module ActiveRecordVersions
def self.configure_example_group(example_group)
example_group.include(self)
example_group.extend(self)
end
extend self
def active_record_version
Tests::Version.new(::ActiveRecord::VERSION::STRING)
end
def active_record_enum_supports_prefix_and_suffix?
active_record_version >= 5
end
def active_record_supports_has_secure_password?
active_record_version >= 3.1
end
def active_record_supports_has_secure_token?
active_record_version >= 5.0
end
def active_record_supports_array_columns?
active_record_version > 4.2
end
def active_record_supports_relations?
active_record_version >= 4
end
def active_record_supports_more_dependent_options?
active_record_version >= 4
end
def active_record_uniqueness_supports_array_columns?
active_record_version < 5
end
def active_record_supports_optional_for_associations?
active_record_version >= 5
end
def active_record_supports_expression_indexes?
active_record_version >= 5
end
def active_record_supports_active_storage?
active_record_version >= 5.2
end
def active_record_supports_validate_presence_on_active_storage?
active_record_version >= '6.0.0.beta1'
end
def active_record_supports_implicit_order_column?
active_record_version >= '6.0.0.beta1'
end
end
end