Skip to content

Commit 027dc94

Browse files
tests and docs updates
1 parent 728c367 commit 027dc94

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/shoulda/matchers/active_record/association_matcher.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ def have_delegated_type(name)
10121012
# ##### deprecated
10131013
#
10141014
# Use `deprecated` to assert that the `:deprecated` option was specified.
1015-
# (Rails 8.1+).
1015+
# (Enabled by default in Rails 8.1+)
10161016
#
10171017
# class Player < ActiveRecord::Base
10181018
# has_many :games, deprecated: true
@@ -1643,11 +1643,11 @@ def join_table(join_table_name)
16431643
end
16441644

16451645
def deprecated(deprecated = true)
1646-
if Rails::VERSION::STRING >= '8.1'
1646+
if ::ActiveRecord::VERSION::STRING >= '8.1'
16471647
@options[:deprecated] = deprecated
16481648
self
16491649
else
1650-
raise NotImplementedError, "`deprecated` association matcher is only available on Rails version >= 8.1."
1650+
raise NotImplementedError, "`deprecated` association matcher is only available on Active Record >= 8.1."
16511651
end
16521652
end
16531653

spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
if rails_version <= 8.1
77
context "using the deprecated matcher" do
88
it 'raises a NotImplementedError' do
9+
message = "`deprecated` association matcher is only available on Active Record >= 8.1."
10+
911
expect do
1012
expect(having_many_children(deprecated: false)).to have_many(:children).deprecated(false)
11-
end.to fail_with_message("hello")
13+
end.to fail_with_message(message)
1214
end
1315
end
1416
end

0 commit comments

Comments
 (0)