Sha256: 5a1bcc6056af4b83d3a169d5f82a5bffe31bfeed78c5623ec52075914b27d30a

Contents?: true

Size: 716 Bytes

Versions: 24

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Mongoid::Errors::UnknownAttribute do

  describe "#message" do

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

    it "contains the problem in the message" do
      expect(error.message).to include(
        "Attempted to set a value for 'gender' which is not allowed on"
      )
    end

    it "contains the summary in the message" do
      expect(error.message).to include(
        "Person#gender= was called but there is no 'gender'"
      )
    end

    it "contains the resolution in the message" do
      expect(error.message).to include(
        "Define the field 'gender' in Person, or include"
      )
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
mongoid-8.0.1 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-7.5.0 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-7.4.1 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-7.4.0 spec/mongoid/errors/unknown_attribute_spec.rb