Sha256: 1a7239a325b00bad20c20361a099f0230a5368db351c6966604b27bdcea4c5b5

Contents?: true

Size: 745 Bytes

Versions: 13

Compression:

Stored size: 745 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 delete 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,"
      )
    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

13 entries across 13 versions & 2 rubygems

Version Path
mongoid-7.1.11 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.10 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.9 spec/mongoid/errors/delete_restriction_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.8 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.7 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.6 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.5 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.4 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.2 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.1 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.0 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-7.1.0.rc0 spec/mongoid/errors/delete_restriction_spec.rb