diff --git a/spec/mongoid/errors/document_not_found_spec.rb b/spec/mongoid/errors/document_not_found_spec.rb index 2bf9b302b8..803a7ed5a0 100644 --- a/spec/mongoid/errors/document_not_found_spec.rb +++ b/spec/mongoid/errors/document_not_found_spec.rb @@ -64,9 +64,15 @@ end it "contains the problem in the message" do - expect(error.message).to include( - "Document not found for class Person with attributes {:name=>\"syd\"}." - ) + if RUBY_VERSION >= '3.4.0' + expect(error.message).to include( + 'Document not found for class Person with attributes {name: "syd"}.' + ) + else + expect(error.message).to include( + 'Document not found for class Person with attributes {:name=>"syd"}.' + ) + end end it "contains the summary in the message" do