Sha256: 5a1bcc6056af4b83d3a169d5f82a5bffe31bfeed78c5623ec52075914b27d30a

Contents?: true

Size: 716 Bytes

Versions: 29

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

29 entries across 29 versions & 1 rubygems

Version Path
mongoid-8.0.10 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.10 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.9 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.0.9 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.8 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.7 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.6 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.0.8 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.5 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.4 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.0.7 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.3 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.2 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.0.6 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-7.5.4 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.1 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.0.5 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.1.0 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-7.5.3 spec/mongoid/errors/unknown_attribute_spec.rb
mongoid-8.0.4 spec/mongoid/errors/unknown_attribute_spec.rb