Sha256: 84f4ddd75506210e27828004efdd2fc551217359897d28bf9cab1f4135deef3d

Contents?: true

Size: 739 Bytes

Versions: 25

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

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

25 entries across 25 versions & 1 rubygems

Version Path
mongoid-8.1.8 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.7 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.6 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.0.8 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.5 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.4 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.0.7 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.3 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.2 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.0.6 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.5.4 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.1 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.0.5 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.1.0 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.5.3 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.0.4 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.0.3 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.5.2 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-8.0.2 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.5.1 spec/mongoid/errors/delete_restriction_spec.rb