Skip to content

Commit d6ed0e5

Browse files
duh
1 parent a813543 commit d6ed0e5

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
@@ -795,18 +795,6 @@ def ensure_parent_is_set
795795
end
796796
end
797797

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-
810798
def belonging_to_parent(options = {}, parent_options = {}, &block)
811799
child_model = create_child_model_belonging_to_parent(
812800
options,
@@ -859,6 +847,18 @@ def belonging_to_non_existent_class(model_name, assoc_name, options = {})
859847
end
860848

861849
context 'have_many' do
850+
if rails_version <= 8.1
851+
context 'using the deprecated matcher' do
852+
it 'raises a NotImplementedError' do
853+
message = '`deprecated` association matcher is only available on Active Record >= 8.1.'
854+
855+
expect do
856+
expect(having_many_children(deprecated: false)).to have_many(:children).deprecated(false)
857+
end.to fail_with_message(message)
858+
end
859+
end
860+
end
861+
862862
it 'accepts a valid association without any options' do
863863
expect(having_many_children).to have_many(:children)
864864
end

0 commit comments

Comments
 (0)