Sha256: ca994181cb9583410a37d2166fd1432c419d13d7483c6bb0a7f9caf6269f149a

Contents?: true

Size: 684 Bytes

Versions: 3

Compression:

Stored size: 684 Bytes

Contents

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
      error.message.should include(
        "Cannot delete Person because of dependent 'drugs'."
      )
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid-3.1.7 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-3.1.6 spec/mongoid/errors/delete_restriction_spec.rb
mongoid-3.1.5 spec/mongoid/errors/delete_restriction_spec.rb