spec/models/message.rb in mongoid-rspec-4.0.1 vs spec/models/message.rb in mongoid-rspec-4.1.0
- old
+ new
@@ -3,9 +3,15 @@
field :identifier
field :from
field :to
+ if Mongoid::Compatibility::Version.mongoid6_or_newer?
+ belongs_to :user, optional: true
+ else
+ belongs_to :user
+ end
+
validates :identifier, uniqueness: { message: 'uniqueness' }
validates :from, presence: { message: 'required' }
validates :to, format: { with: /[a-z]+/, message: 'format' }
end