Skip to content

Commit a813543

Browse files
oops, the method is only available inside of the context
1 parent 5a70069 commit a813543

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
describe Shoulda::Matchers::ActiveRecord::AssociationMatcher, type: :model do
44
include UnitTests::ApplicationConfigurationHelpers
55

6-
if rails_version <= 8.1
7-
context 'using the deprecated matcher' do
8-
it 'raises a NotImplementedError' do
9-
message = '`deprecated` association matcher is only available on Active Record >= 8.1.'
10-
11-
expect do
12-
expect(having_many_children(deprecated: false)).to have_many(:children).deprecated(false)
13-
end.to fail_with_message(message)
14-
end
15-
end
16-
end
17-
186
context 'belong_to' do
197
it 'accepts a good association with the default foreign key' do
208
expect(belonging_to_parent).to belong_to(:parent)
@@ -807,6 +795,18 @@ def ensure_parent_is_set
807795
end
808796
end
809797

798+
if rails_version <= 8.1
799+
context 'using the deprecated matcher' do
800+
it 'raises a NotImplementedError' do
801+
message = '`deprecated` association matcher is only available on Active Record >= 8.1.'
802+
803+
expect do
804+
expect(having_many_children(deprecated: false)).to have_many(:children).deprecated(false)
805+
end.to fail_with_message(message)
806+
end
807+
end
808+
end
809+
810810
def belonging_to_parent(options = {}, parent_options = {}, &block)
811811
child_model = create_child_model_belonging_to_parent(
812812
options,

0 commit comments

Comments
 (0)