Sha256: 5b68d89162f769fdb8ff82c2aa9accfdc5d7bfd5a72bb7e8e6df3c6f202bbf06

Contents?: true

Size: 747 Bytes

Versions: 3

Compression:

Stored size: 747 Bytes

Contents

require 'spec_helper'

describe Mongoid::Errors::AmbiguousRelationship do

  describe "#message" do

    let(:error) do
      described_class.new(Person, Drug, :person, [ :drugs, :evil_drugs ])
    end

    it "contains the problem in the message" do
      error.message.should include(
        "Ambiguous relations :drugs, :evil_drugs defined on Person."
      )
    end

    it "contains the summary in the message" do
      error.message.should include(
        "When Mongoid attempts to set an inverse document of a relation in memory"
      )
    end

    it "contains the resolution in the message" do
      error.message.should include(
        "On the :person relation on Drug you must add an :inverse_of option"
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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