Skip to content

Commit

Permalink
Remove active_record_gte_5? method
Browse files Browse the repository at this point in the history
  • Loading branch information
vsppedro committed Mar 21, 2021
1 parent 02b61dd commit 76ea384
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/shoulda/matchers/active_record/association_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ def initialize(macro, name)
@submatchers = []
@missing = ''

if macro == :belongs_to && RailsShim.active_record_gte_5?
if macro == :belongs_to
required(belongs_to_required_by_default?)
end
end
Expand Down
16 changes: 2 additions & 14 deletions lib/shoulda/matchers/rails_shim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ def action_pack_version
Gem::Version.new('0')
end

def active_record_gte_5?
Gem::Requirement.new('>= 5').satisfied_by?(active_record_version)
end

def active_record_gte_6?
Gem::Requirement.new('>= 6').satisfied_by?(active_record_version)
end
Expand Down Expand Up @@ -73,23 +69,15 @@ def attribute_serialization_coder_for(model, attribute_name)
end

def tables_and_views(connection)
if active_record_gte_5?
connection.data_sources
else
connection.tables
end
connection.data_sources
end

def verb_for_update
:patch
end

def validation_message_key_for_association_required_option
if active_record_gte_5?
:required
else
:blank
end
:required
end

def parent_of(mod)
Expand Down

0 comments on commit 76ea384

Please sign in to comment.