Sha256: ea937f28693498f2b6f761ee807431caaf3fff255186e0d38bb74b46ad3c1d68

Contents?: true

Size: 757 Bytes

Versions: 6

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require "spec_helper"

describe Mongoid::Errors::DeleteRestriction do

  describe "#message" do

    let(:error) do
      described_class.new(Person.new, :drugs)
    end

    it "contains the problem in the message" do
      expect(error.message).to include(
        "Cannot destroy Person because of dependent 'drugs'."
      )
    end

    it "contains the summary in the message" do
      expect(error.message).to include(
        "When defining 'drugs' with a :dependent => :restrict_with_error,"
      )
    end

    it "contains the resolution in the message" do
      expect(error.message).to include(
        "Don't attempt to delete the parent Person when it has children"
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongoid-7.3.5 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.3.4 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.3.3 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.3.2 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.3.1 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.3.0 spec/mongoid/errors/delete_restriction_spec.rb