repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb | spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative "../has_and_belongs_to_many_models"
describe Mongoid::Association::Referenced::HasAndBelongsToMany::Proxy do
config_override :raise_not_found_error, true
around(:each) do |example|
original_preferences_association = Perso... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | true |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_and_belongs_to_many/binding_spec.rb | spec/mongoid/association/referenced/has_and_belongs_to_many/binding_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::HasAndBelongsToMany::Binding do
let(:person) do
Person.new
end
let(:preference) do
Preference.new
end
let(:target) do
Mongoid::Association::Referenced::HasMany::Enumerable.new([ p... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_persistence_spec.rb | spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_persistence_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative '../has_and_belongs_to_many_models'
describe Mongoid::Association::Referenced::HasAndBelongsToMany::Proxy do
context 'with primary_key and foreign_key given' do
let(:company) { HabtmmCompany.create!(c_id: 123) }
let(:emp... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_one/buildable_spec.rb | spec/mongoid/association/referenced/has_one/buildable_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::HasOne::Buildable do
let(:base) do
double(new_record?: false)
end
describe "#build" do
let(:document) do
association.build(base, object)
end
let(:options) do
{}
e... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_one/eager_spec.rb | spec/mongoid/association/referenced/has_one/eager_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative '../has_one_models'
describe Mongoid::Association::Referenced::HasOne::Eager do
describe ".grouped_doc" do
let(:person) do
Person.create!
end
let(:docs) do
Person.all.to_a
end
let(:association... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_one/proxy_spec.rb | spec/mongoid/association/referenced/has_one/proxy_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::HasOne::Proxy do
describe "#=" do
context "when the relationship is an illegal embedded reference" do
let(:game) do
Game.new
end
let(:video) do
Video.new
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_one/binding_spec.rb | spec/mongoid/association/referenced/has_one/binding_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::HasOne::Binding do
let(:person) do
Person.new
end
let(:game) do
Game.new
end
let(:association) do
Person.relations["game"]
end
describe "#bind_one" do
let(:binding) do
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_many/buildable_spec.rb | spec/mongoid/association/referenced/has_many/buildable_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::HasMany::Buildable do
let(:base) do
double
end
describe "#build" do
let(:documents) do
association.build(base, object)
end
let(:options) do
{}
end
let(:assoc... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_many/eager_spec.rb | spec/mongoid/association/referenced/has_many/eager_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative '../has_many_models'
describe Mongoid::Association::Referenced::HasMany::Eager do
describe ".grouped_docs" do
let(:docs) do
Person.all.to_a
end
let(:person) do
Person.create!
end
let(:associat... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_many/proxy_spec.rb | spec/mongoid/association/referenced/has_many/proxy_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
module RefHasManySpec
module OverrideInitialize
class Parent
include Mongoid::Document
has_many :children, inverse_of: :parent
end
class Child
include Mongoid::Document
belongs_to :parent
field :name, t... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | true |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_many/binding_spec.rb | spec/mongoid/association/referenced/has_many/binding_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::HasMany::Binding do
let(:person) do
Person.new
end
let(:post) do
Post.new
end
let(:target) do
Mongoid::Association::Referenced::HasMany::Enumerable.new([ post ])
end
let(:ass... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_many/proxy_query_spec.rb | spec/mongoid/association/referenced/has_many/proxy_query_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative '../has_many_models'
describe Mongoid::Association::Referenced::HasMany::Proxy do
context 'with primary_key and foreign_key given' do
let(:company) { HmmCompany.create!(p: 123) }
let(:criteria) { company.emails }
it... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/has_many/enumerable_spec.rb | spec/mongoid/association/referenced/has_many/enumerable_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::HasMany::Enumerable do
describe "#==" do
context "when comparing with an enumerable" do
let(:person) do
Person.create!
end
let!(:post) do
Post.create!(person_id... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | true |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/belongs_to/buildable_spec.rb | spec/mongoid/association/referenced/belongs_to/buildable_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::BelongsTo::Buildable do
let(:base) do
double
end
describe "#build" do
let(:document) do
association.build(base, object)
end
let(:options) do
{}
end
let(:asso... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/belongs_to/eager_spec.rb | spec/mongoid/association/referenced/belongs_to/eager_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative '../has_many_models'
require_relative '../has_one_models'
describe Mongoid::Association::Referenced::BelongsTo::Eager do
describe ".grouped_docs" do
let(:docs) do
Post.all.to_a
end
let(:person) do
Pers... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb | spec/mongoid/association/referenced/belongs_to/proxy_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require 'support/models/canvas'
require_relative '../belongs_to_models.rb'
describe Mongoid::Association::Referenced::BelongsTo::Proxy do
before(:all) do
Person.reset_callbacks(:validate)
end
let(:person) do
Person.create!
end
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/referenced/belongs_to/binding_spec.rb | spec/mongoid/association/referenced/belongs_to/binding_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Referenced::BelongsTo::Binding do
let(:person) do
Person.new
end
let(:game) do
Game.new
end
let(:post) do
Post.new
end
let(:game_association) do
Game.relations["person"]
end
let... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/nested/many_spec.rb | spec/mongoid/association/nested/many_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Nested::Many do
let(:association) do
Person.relations['addresses']
end
let(:person) do
Person.new
end
describe "#allow_destroy?" do
context "when the option is provided" do
let(:build... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/nested/one_spec.rb | spec/mongoid/association/nested/one_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Nested::One do
let(:association) do
Person.relations['name']
end
describe "#allow_destroy?" do
context "when the option is provided" do
let(:builder) do
described_class.new(association... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/cyclic_spec.rb | spec/mongoid/association/embedded/cyclic_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::Cyclic do
describe ".recursively_embeds_many" do
context "when the name is inflected easily" do
let(:document) do
Role.new
end
it "creates the parent relation" do
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embedded_in_spec.rb | spec/mongoid/association/embedded/embedded_in_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative './embeds_one_models'
describe Mongoid::Association::Embedded::EmbeddedIn do
before do
class Container; include Mongoid::Document; end
class EmbeddedObject; include Mongoid::Document; end
end
after do
Object.se... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_one_dnl_models.rb | spec/mongoid/association/embedded/embeds_one_dnl_models.rb | # frozen_string_literal: true
# rubocop:todo all
# This file is added as an autoload target, but should never be actually
# processed.
# Marker class - if this class exists, this file was attempted to be required.
class EoDnlMarker
end
| ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/dirty_spec.rb | spec/mongoid/association/embedded/dirty_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe "when initialize a model with an embedded model" do
let(:person) do
Person.new(pet: Pet.new)
end
it "has changes in the embedded model" do
expect(person.pet.changes).to_not be_empty
end
it "does not have previous_chan... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_one_query_spec.rb | spec/mongoid/association/embedded/embeds_one_query_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative './embeds_one_models'
describe Mongoid::Association::Embedded::EmbedsOne do
context 'when projecting with #only' do
before do
parent = EomParent.new(name: 'foo')
parent.child = EomChild.new(a: 1, b: 2)
par... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_many_query_spec.rb | spec/mongoid/association/embedded/embeds_many_query_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative './embeds_many_models'
describe Mongoid::Association::Embedded::EmbedsMany do
context 'when projecting with #only' do
before do
congress = EmmCongress.new(name: 'foo')
congress.legislators << EmmLegislator.new(a... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_one_spec.rb | spec/mongoid/association/embedded/embeds_one_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative './embeds_one_models'
describe Mongoid::Association::Embedded::EmbedsOne do
before do
class Container; include Mongoid::Document; end
class EmbeddedObject; include Mongoid::Document; end
end
after do
Container.... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_many_spec.rb | spec/mongoid/association/embedded/embeds_many_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative 'embeds_many_models'
describe Mongoid::Association::Embedded::EmbedsMany do
before do
class Container; include Mongoid::Document; end
class EmbeddedObject; include Mongoid::Document; end
end
after do
Container.... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_one_models.rb | spec/mongoid/association/embedded/embeds_one_models.rb | # frozen_string_literal: true
# rubocop:todo all
class EomParent
include Mongoid::Document
include Mongoid::Timestamps
embeds_one :child, class_name: 'EomChild'
field :name, type: String
end
class EomChild
include Mongoid::Document
embedded_in :parent, class_name: 'EomParent'
field :a, type: Integer... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_many_models.rb | spec/mongoid/association/embedded/embeds_many_models.rb | # frozen_string_literal: true
# rubocop:todo all
class EmmCongress
include Mongoid::Document
include Mongoid::Timestamps
embeds_many :legislators, class_name: 'EmmLegislator'
field :name, type: String
end
class EmmLegislator
include Mongoid::Document
embedded_in :congress, class_name: 'EmmCongress'
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_one/buildable_spec.rb | spec/mongoid/association/embedded/embeds_one/buildable_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::EmbedsOne::Buildable do
let(:base) do
double
end
let(:options) do
{ }
end
describe "#build" do
let(:document) do
association.build(base, object)
end
let(:association... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_one/proxy_spec.rb | spec/mongoid/association/embedded/embeds_one/proxy_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::EmbedsOne::Proxy do
describe "#===" do
let(:base) do
Person.new
end
let(:target) do
Name.new
end
let(:association) do
Person.relations["name"]
end
let(:r... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_one/binding_spec.rb | spec/mongoid/association/embedded/embeds_one/binding_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::EmbedsOne::Binding do
let(:person) do
Person.new
end
let(:target) do
Name.new
end
let(:association) do
Person.relations["name"]
end
describe "#bind" do
let(:binding) do
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embedded_in/buildable_spec.rb | spec/mongoid/association/embedded/embedded_in/buildable_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::EmbeddedIn::Buildable do
describe "#build" do
let(:base) do
double
end
let(:options) do
{ }
end
let(:association) do
Mongoid::Association::Embedded::EmbeddedIn.ne... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embedded_in/proxy_spec.rb | spec/mongoid/association/embedded/embedded_in/proxy_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative '../embeds_many_models'
describe Mongoid::Association::Embedded::EmbeddedIn::Proxy do
describe "#===" do
let(:base) do
Name.new
end
let(:target) do
Person.new
end
let(:association) do
Na... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embedded_in/binding_spec.rb | spec/mongoid/association/embedded/embedded_in/binding_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::EmbeddedIn::Binding do
let(:person) do
Person.new
end
let(:name) do
Name.new
end
let(:address) do
Address.new
end
let(:name_association) do
Name.relations["namable"]
end
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_many/buildable_spec.rb | spec/mongoid/association/embedded/embeds_many/buildable_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::EmbedsMany::Buildable do
let(:base) do
double
end
let(:options) do
{ }
end
describe "#build" do
let(:documents) do
association.build(base, object)
end
let(:associati... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_many/proxy_spec.rb | spec/mongoid/association/embedded/embeds_many/proxy_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
require_relative '../embeds_many_models.rb'
describe Mongoid::Association::Embedded::EmbedsMany::Proxy do
[ :<<, :push ].each do |method|
describe "##{method}" do
context "when the parent is a new record" do
let(:person) do... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | true |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/association/embedded/embeds_many/binding_spec.rb | spec/mongoid/association/embedded/embeds_many/binding_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Association::Embedded::EmbedsMany::Binding do
let(:person) do
Person.new
end
let(:address) do
Address.new
end
let(:target) do
[ address ]
end
let(:association) do
Person.relations["addresses"]
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_field_type_spec.rb | spec/mongoid/errors/invalid_field_type_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidFieldType do
describe "#message" do
let(:error) do
described_class.new(Person, :first_name, :stringgy)
end
context 'when type is a symbol' do
let(:error) do
described_class.new(... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/unsupported_javascript_spec.rb | spec/mongoid/errors/unsupported_javascript_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::UnsupportedJavascript do
describe "#message" do
let(:error) do
described_class.new(Address, "this.street == null")
end
it "contains the problem in the message" do
expect(error.message).to incl... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_client_database_spec.rb | spec/mongoid/errors/no_client_database_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NoClientDatabase do
describe "#message" do
let(:error) do
described_class.new(:analytics, { hosts: [ "127.0.0.1:27017" ] })
end
it "contains the problem in the message" do
expect(error.message... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_client_hosts_spec.rb | spec/mongoid/errors/no_client_hosts_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NoClientHosts do
describe "#message" do
let(:error) do
described_class.new(:analytics, { database: "mongoid_test" })
end
it "contains the problem in the message" do
expect(error.message).to in... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_metadata_spec.rb | spec/mongoid/errors/no_metadata_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe Mongoid::Errors::NoMetadata do
describe "#message" do
let(:error) do
described_class.new(Address)
end
it "contains the problem in the message" do
expect(error.message).to include("Metadata not found for docume... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_parent_spec.rb | spec/mongoid/errors/no_parent_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NoParent do
describe "#message" do
let(:error) do
described_class.new(Address)
end
it "contains the problem in the message" do
expect(error.message).to include(
"Cannot persist embedde... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_clients_config_spec.rb | spec/mongoid/errors/no_clients_config_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NoClientsConfig do
describe "#message" do
let(:error) do
described_class.new
end
it "contains the problem in the message" do
expect(error.message).to include(
"No clients configuration... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_config_file_spec.rb | spec/mongoid/errors/invalid_config_file_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidConfigFile do
describe "#message" do
let(:error) do
described_class.new('/my/path')
end
it "contains the problem in the message" do
expect(error.message).to include(
"Invalid co... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_time_spec.rb | spec/mongoid/errors/invalid_time_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidTime do
describe "#message" do
let(:error) do
described_class.new("this is not a date")
end
it "contains the problem in the message" do
expect(error.message).to include(
"'this ... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/ambiguous_relationship_spec.rb | spec/mongoid/errors/ambiguous_relationship_spec.rb | # frozen_string_literal: true
# rubocop:todo all
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
expect(error.... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_client_config_spec.rb | spec/mongoid/errors/no_client_config_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NoClientConfig do
describe "#message" do
let(:error) do
described_class.new(:analytics)
end
it "contains the problem in the message" do
expect(error.message).to include(
"No configurat... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_storage_options_spec.rb | spec/mongoid/errors/invalid_storage_options_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidStorageOptions do
describe "#message" do
let(:error) do
described_class.new(Band, :bad_option)
end
it "contains the problem in the message" do
expect(error.message).to include(
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/unknown_attribute_spec.rb | spec/mongoid/errors/unknown_attribute_spec.rb | # frozen_string_literal: true
# rubocop:todo all
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(
"Attemp... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/validations_spec.rb | spec/mongoid/errors/validations_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::Validations do
describe "#message" do
let(:errors) do
double(full_messages: [ "Error 1", "Error 2" ], empty?: false)
end
let(:document) do
double(errors: errors, class: Person)
end
le... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/unsaved_document_spec.rb | spec/mongoid/errors/unsaved_document_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::UnsavedDocument do
describe "#message" do
let(:base) do
Person.new
end
let(:document) do
Post.new
end
let(:error) do
described_class.new(base, document)
end
it "contain... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_index_spec.rb | spec/mongoid/errors/invalid_index_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidIndex do
describe "#message" do
let(:error) do
described_class.new(Band, { name: 1 }, { invalid: true })
end
it "contains the problem in the message" do
expect(error.message).to include... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/too_many_nested_attribute_records_spec.rb | spec/mongoid/errors/too_many_nested_attribute_records_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::TooManyNestedAttributeRecords do
describe "#message" do
let(:error) do
described_class.new("favorites", 5)
end
it "contains the problem in the message" do
expect(error.message).to include(
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_config_option_spec.rb | spec/mongoid/errors/invalid_config_option_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidConfigOption do
describe "#message" do
let(:error) do
described_class.new(:bad_option)
end
it "contains the problem in the message" do
expect(error.message).to include(
"Invalid... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/document_not_found_spec.rb | spec/mongoid/errors/document_not_found_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::DocumentNotFound do
describe "#message" do
context "when providing an id" do
let(:error) do
described_class.new(Person, 1, 1)
end
it "contains the problem in the message" do
exp... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_relation_spec.rb | spec/mongoid/errors/invalid_relation_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidRelation do
describe "#message" do
module MyModule
def crazy_method; self; end
end
before do
Object.send(:include, MyModule)
end
let(:error) do
described_class.new(Person... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/mongoid_error_spec.rb | spec/mongoid/errors/mongoid_error_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe Mongoid::Errors::MongoidError do
let(:error) { described_class.new }
let(:key) { :callbacks }
let(:options) { {} }
before do
{"message_title" => "message", "summary_title" => "summary", "resolution_title" => "resolution"}.ea... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_find_spec.rb | spec/mongoid/errors/invalid_find_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidFind do
describe "#message" do
let(:error) do
described_class.new
end
it "contains the problem in the message" do
expect(error.message).to include(
"Calling Document.find with n... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/mixed_relations_spec.rb | spec/mongoid/errors/mixed_relations_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::MixedRelations do
describe "#message" do
let(:error) do
described_class.new(Post, Address)
end
it "contains the problem in the message" do
expect(error.message).to include(
"Referencin... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_field_option_spec.rb | spec/mongoid/errors/invalid_field_option_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidFieldOption do
describe "#message" do
let(:error) do
described_class.new(Person, :testing, :localized, [ :localize ])
end
it "contains the problem in the message" do
expect(error.messag... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_includes_spec.rb | spec/mongoid/errors/invalid_includes_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidIncludes do
describe "#message" do
context "default" do
let(:klass) do
Band
end
let(:args) do
[ :members ]
end
let(:error) do
described_class.new(kla... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_scope_spec.rb | spec/mongoid/errors/invalid_scope_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidScope do
describe "#message" do
let(:error) do
described_class.new(Band, {})
end
it "contains the problem in the message" do
expect(error.message).to include(
"Defining a scope ... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/document_not_destroyed_spec.rb | spec/mongoid/errors/document_not_destroyed_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::DocumentNotDestroyed do
describe "#message" do
let(:post) do
Post.new
end
let(:error) do
described_class.new(post.id, Post)
end
it "contains the problem in the message" do
expec... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/readonly_document_spec.rb | spec/mongoid/errors/readonly_document_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::ReadonlyDocument do
describe "#message" do
let(:error) do
described_class.new(Band)
end
it "contains the problem in the message" do
expect(error.message).to include(
"Attempted to pers... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/inverse_not_found_spec.rb | spec/mongoid/errors/inverse_not_found_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InverseNotFound do
describe "#message" do
let(:error) do
described_class.new("Town", :citizens, "Person", :town_id)
end
it "contains the problem in the message" do
expect(error.message).to inc... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_path_spec.rb | spec/mongoid/errors/invalid_path_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe Mongoid::Errors::InvalidPath do
describe "#message" do
let(:error) do
described_class.new(Address)
end
it "contains the problem in the message" do
expect(error.message).to include("Having a root path assigned ... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/scope_overwrite_spec.rb | spec/mongoid/errors/scope_overwrite_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::ScopeOverwrite do
describe "#message" do
let(:error) do
described_class.new("Person", "scope")
end
it "contains the problem in the message" do
expect(error.message).to include(
"Cannot... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/mixed_client_configuration_spec.rb | spec/mongoid/errors/mixed_client_configuration_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::MixedClientConfiguration do
describe "#message" do
let(:error) do
described_class.new(:testing, { uri: "blah" })
end
it "contains the problem in the message" do
expect(error.message).to includ... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_map_reduce_output_spec.rb | spec/mongoid/errors/no_map_reduce_output_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NoMapReduceOutput do
describe "#message" do
let(:error) do
described_class.new(query: {})
end
it "contains the problem in the message" do
expect(error.message).to include(
"No output l... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/callback_spec.rb | spec/mongoid/errors/callback_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::Callback do
describe "#message" do
let(:error) do
described_class.new(Post, :create!)
end
it "contains the problem in the message" do
expect(error.message).to include(
"Calling create!... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_collection_spec.rb | spec/mongoid/errors/invalid_collection_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidCollection do
describe "#message" do
context "default" do
let(:klass) do
Address
end
let(:error) do
described_class.new(klass)
end
it "contains the problem i... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/no_environment_spec.rb | spec/mongoid/errors/no_environment_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NoEnvironment do
describe "#message" do
let(:error) do
described_class.new
end
it "contains the problem in the message" do
expect(error.message).to include(
"Mongoid could not determin... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/delete_restriction_spec.rb | spec/mongoid/errors/delete_restriction_spec.rb | # frozen_string_literal: true
# rubocop:todo all
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(
"Ca... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_options_spec.rb | spec/mongoid/errors/invalid_options_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidOptions do
describe "#message" do
let(:error) do
described_class.new(:name, :invalid, [ :valid ])
end
it "contains the problem in the message" do
expect(error.message).to include(
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/attribute_not_loaded_spec.rb | spec/mongoid/errors/attribute_not_loaded_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::AttributeNotLoaded do
describe "#message" do
let(:error) do
described_class.new(Band, :label)
end
it "contains the problem in the message" do
expect(error.message).to include(
"Attempt... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/readonly_attribute_spec.rb | spec/mongoid/errors/readonly_attribute_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::ReadonlyAttribute do
describe "#message" do
let(:error) do
described_class.new(:title, "mr")
end
it "contains the problem in the message" do
expect(error.message).to include(
"Attempte... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_field_spec.rb | spec/mongoid/errors/invalid_field_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidField do
describe "#message" do
module MyModule
def crazy_method; self; end
end
before do
Object.send(:include, MyModule)
end
let(:error) do
described_class.new(Person, :... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/invalid_set_polymorphic_relation_spec.rb | spec/mongoid/errors/invalid_set_polymorphic_relation_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::InvalidSetPolymorphicRelation do
describe "#message" do
let(:error) do
described_class.new(:postable, Post, Person)
end
it "contains the problem in the message" do
expect(error.message).to inc... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/errors/nested_attributes_metadata_not_found_spec.rb | spec/mongoid/errors/nested_attributes_metadata_not_found_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Errors::NestedAttributesMetadataNotFound do
describe "#message" do
let(:error) do
described_class.new(Person, :posts)
end
it "contains the problem in the message" do
expect(error.message).to include(
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/symbol_spec.rb | spec/mongoid/extensions/symbol_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Symbol do
[ :mongoize, :demongoize ].each do |method|
describe ".mongoize" do
context "when the object is not a symbol" do
it "returns the symbol" do
expect(Symbol.send(method, "test"... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/string_spec.rb | spec/mongoid/extensions/string_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::String do
describe "#__evolve_object_id__" do
context "when the string is blank" do
it "returns the empty string" do
expect("".__evolve_object_id__).to be_empty
end
end
context "w... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/array_spec.rb | spec/mongoid/extensions/array_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Array do
describe "#__evolve_object_id__" do
context "when provided an array of strings" do
let(:object_id) do
BSON::ObjectId.new
end
let(:other) do
"blah"
end
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/raw_value_spec.rb | spec/mongoid/extensions/raw_value_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::RawValue do
describe "::()" do
subject { Mongoid::RawValue(raw_value).raw_value }
context 'when raw_value is a String' do
let(:raw_value) { 'Hello World!' }
it 'returns the value' do
is_expected.t... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/module_spec.rb | spec/mongoid/extensions/module_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Module do
describe "#re_define_method" do
context "when the method already exists" do
class Smoochy
def sing
"singing"
end
end
before do
Smoochy.re_define_... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/range_spec.rb | spec/mongoid/extensions/range_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Range do
describe ".demongoize" do
subject { Range.demongoize(hash) }
context "when the range is ascending" do
let(:hash) { { "min" => 1, "max" => 3 } }
it "returns an ascending range" do
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/date_time_spec.rb | spec/mongoid/extensions/date_time_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::DateTime do
describe "__mongoize_time__" do
let(:date_time) do
# DateTime has time zone information, even if a time zone is not provided
# when parsing a string
DateTime.parse("2012-06-17 18:... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/true_class_spec.rb | spec/mongoid/extensions/true_class_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::TrueClass do
describe "#is_a?" do
context "when provided a Boolean" do
it "returns true" do
expect(true.is_a?(Mongoid::Boolean)).to be true
end
end
context "when provided a FalseC... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/big_decimal_spec.rb | spec/mongoid/extensions/big_decimal_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::BigDecimal do
let(:big_decimal) do
BigDecimal("123456.789")
end
context 'when map_big_decimal_to_decimal128 is false' do
config_override :map_big_decimal_to_decimal128, false
describe ".demongoize... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/object_spec.rb | spec/mongoid/extensions/object_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Object do
let(:object) do
Object.new
end
describe "#__evolve_object_id__" do
it "returns self" do
expect(object.__evolve_object_id__).to eq(object)
end
end
describe "#__mongoize_object_... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/false_class_spec.rb | spec/mongoid/extensions/false_class_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::FalseClass do
describe "#is_a?" do
context "when provided a Boolean" do
it "returns true" do
expect(false.is_a?(Mongoid::Boolean)).to be true
end
end
context "when provided a Fals... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/set_spec.rb | spec/mongoid/extensions/set_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Set do
describe "#demongoize" do
it "returns the set if Array" do
expect(Set.demongoize([ "test" ])).to eq(Set.new([ "test" ]))
end
end
describe ".mongoize" do
it "returns an array" do
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/hash_spec.rb | spec/mongoid/extensions/hash_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Hash do
describe "#__evolve_object_id__" do
context "when values have object id strings" do
let(:object_id) do
BSON::ObjectId.new
end
let(:hash) do
{ field: object_id.to_s }... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/object_id_spec.rb | spec/mongoid/extensions/object_id_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::ObjectId do
let(:object_id) do
BSON::ObjectId.new
end
let(:composite_key) do
"21-jump-street"
end
describe "#__evolve_object_id__" do
it "returns self" do
expect(object_id.__evolve_obje... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/binary_spec.rb | spec/mongoid/extensions/binary_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe BSON::Binary do
describe "#mongoize" do
let(:binary) do
BSON::Binary.new("testing", :md5)
end
it "returns the binary" do
expect(binary.mongoize).to eq(binary)
end
end
[ :mongoize, :demongoize].each d... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/stringified_symbol_spec.rb | spec/mongoid/extensions/stringified_symbol_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::StringifiedSymbol do
describe ".demongoize" do
context "when the object is not a symbol" do
it "returns the symbol" do
expect(Mongoid::StringifiedSymbol.demongoize("test")).to eq(:test)
end
end
... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/date_class_mongoize_spec.rb | spec/mongoid/extensions/date_class_mongoize_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Date do
describe ".mongoize" do
context "when provided a date" do
let(:date) do
Date.new(2010, 1, 1)
end
let(:mongoized) do
Date.mongoize(date)
end
let(:expecte... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/decimal128_spec.rb | spec/mongoid/extensions/decimal128_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Decimal128 do
let(:decimal128) do
BSON::Decimal128.new("0.0005")
end
describe "#__evolve_decimal128__" do
it "returns the same instance" do
expect(decimal128.__evolve_decimal128__).to be(decimal... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
mongodb/mongoid | https://github.com/mongodb/mongoid/blob/780b2fd823670611d49b3470d6b492e2a19dacf5/spec/mongoid/extensions/time_spec.rb | spec/mongoid/extensions/time_spec.rb | # frozen_string_literal: true
# rubocop:todo all
require "spec_helper"
describe Mongoid::Extensions::Time do
describe ".demongoize" do
let!(:time) do
Time.zone.local(2010, 11, 19)
end
context "when the time zone is not defined" do
config_override :use_utc, false
context "when the l... | ruby | MIT | 780b2fd823670611d49b3470d6b492e2a19dacf5 | 2026-01-04T15:47:58.642616Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.