source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/persistable/maxable_spec.rb
Ruby
mit
3,920
master
4,549
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Persistable::Maxable do describe '#set_max' do shared_examples_for 'a max-able interface' do context 'when the document is a root document' do let(:initial_name) { 'Manhattan Transfer' } let(:initial_members) { 4 } ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/railties/bson_object_id_serializer_spec.rb
Ruby
mit
3,920
master
773
# frozen_string_literal: true require 'spec_helper' begin require 'active_job' require 'mongoid/railties/bson_object_id_serializer' describe 'Mongoid::Railties::ActiveJobSerializers::BsonObjectIdSerializer' do let(:serializer) { Mongoid::Railties::ActiveJobSerializers::BsonObjectIdSerializer.instance } ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/railties/console_sandbox_spec.rb
Ruby
mit
3,920
master
1,150
require 'spec_helper' require 'mongoid/railties/console_sandbox' describe 'console_sandbox' do describe '#check_if_transactions_might_be_available!' do context 'cluster may support transactions' do require_topology :replica_set, :sharded, :load_balanced it 'does not raise' do expect do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/clients/transactions_spec.rb
Ruby
mit
3,920
master
40,946
# frozen_string_literal: true require 'spec_helper' require_relative 'transactions_spec_models' def capture_exception e = nil begin yield rescue StandardError => e e = e end e end describe Mongoid::Clients::Sessions do before(:all) do skip 'Driver does not support transactions' if Gem::Versio...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/clients/factory_spec.rb
Ruby
mit
3,920
master
13,918
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Clients::Factory do shared_examples_for 'includes seed address' do let(:configured_address) do address = SpecConfig.instance.addresses.first address = "#{address}:27017" unless address.include?(':') address end let(...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/clients/transactions_spec_models.rb
Ruby
mit
3,920
master
4,681
class TransactionsSpecCounter def initialize @called = 0 end def inc @called += 1 end def value @called end def reset @called = 0 end end module TransactionsSpecCountable def after_commit_counter @after_commit_counter ||= TransactionsSpecCounter.new end def after_commit_co...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/clients/options_spec.rb
Ruby
mit
3,920
master
20,872
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Clients::Options, retry: 3 do before do # This test asserts on numbers of open connections, # to make these assertions work in jruby we cannot have connections # bleeding from one test to another and this includes background SDAM ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/clients/sessions_spec.rb
Ruby
mit
3,920
master
9,615
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Clients::Sessions do let(:buffer) { StringIO.new } let(:subscriber) do client = Mongoid::Clients.with_name(:other) monitoring = client.send(:monitoring) monitoring.subscribers['Command'].find do |s| s.is_a?(EventSubscriber) ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/fields/standard_spec.rb
Ruby
mit
3,920
master
3,362
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Fields::Standard do describe '#lazy?' do let(:field) do described_class.new(:test, type: String) end it 'returns false' do expect(field).not_to be_lazy end end describe '#pre_processed?' do before(:all) do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/fields/localized_spec.rb
Ruby
mit
3,920
master
13,430
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Fields::Localized do context 'when no default is provided' do let(:field) do described_class.new(:description, localize: true, type: String) end it 'defaults to nil' do expect(field.default_val).to be_nil end end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/fields/foreign_key_spec.rb
Ruby
mit
3,920
master
20,237
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Fields::ForeignKey do describe '#add_atomic_changes' do let(:field) do described_class.new( :vals, association: Person.relations['preferences'], type: Array, default: [], identity: true ) ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/config/defaults_spec.rb
Ruby
mit
3,920
master
2,557
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Config::Defaults do let(:config) do Mongoid::Config end describe '.load_defaults' do shared_examples 'uses settings for 8.0' do it 'uses settings for 8.0' do expect(Mongoid.legacy_readonly).to be true end end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/config/environment_spec.rb
Ruby
mit
3,920
master
4,369
# frozen_string_literal: true require 'spec_helper' require 'support/feature_sandbox' describe Mongoid::Config::Environment do around do |example| FeatureSandbox.quarantine do example.run end end describe '#env_name' do context 'when using rails' do context 'when an environment exists' ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/config/options_spec.rb
Ruby
mit
3,920
master
1,358
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Config::Options do let(:config) do Mongoid::Config end describe '#defaults' do it 'returns the default options' do expect(config.defaults).not_to be_empty end end describe '#option' do context 'when a default is pr...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/config/introspection_spec.rb
Ruby
mit
3,920
master
3,922
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Config::Introspection do context 'CONFIG_RB_PATH' do it 'refers to an actual source file' do expect(File.exist?(Mongoid::Config::Introspection::CONFIG_RB_PATH)).to be true end end describe '#options' do let(:options) { Mong...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/config/encryption_spec.rb
Ruby
mit
3,920
master
4,607
# frozen_string_literal: true require 'spec_helper' require 'support/crypt/models' describe Mongoid::Config::Encryption do describe '.encryption_schema_map' do let(:encryption_schema_map) do Mongoid.config.encryption_schema_map(database_id, models) end context 'when a model has encrypted fields' ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/map_reduce_spec.rb
Ruby
mit
3,920
master
9,354
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::MapReduce do let(:map) do %{ function() { emit(this.name, { likes: this.likes }); }} end let(:reduce) do %{ function(key, values) { var result = { likes: 0 }; values.forEach(function(value) {...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/mongo_spec.rb
Ruby
mit
3,920
master
113,330
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::Mongo do %i[blank? empty?].each do |method| describe "##{method}" do before do Band.create!(name: 'Depeche Mode') end context 'when the count is zero' do let(:criteria) do Band.where(na...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/none_spec.rb
Ruby
mit
3,920
master
3,481
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::None do before do Band.create!(name: 'Depeche Mode') end let(:context) do described_class.new(Band.where(name: 'Depeche Mode')) end describe '#==' do context 'when the other is a none' do let(:other) do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/memory_spec.rb
Ruby
mit
3,920
master
72,241
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::Memory do shared_examples 'raises an error when no documents' do context 'when there are no matching documents' do let(:criteria) do Address.all.tap do |crit| crit.documents = [] end end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/short_circuit_spec.rb
Ruby
mit
3,920
master
4,479
# frozen_string_literal: true require 'spec_helper' describe 'Short-circuit query optimization (MONGOID-5030)' do before { Band.create!(name: 'Depeche Mode') } describe 'allow_short_circuit_queries config option' do it 'defaults to false' do expect(Mongoid.allow_short_circuit_queries).to be false e...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/atomic_spec.rb
Ruby
mit
3,920
master
25,839
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::Atomic do describe '#add_to_set' do let!(:depeche_mode) do Band.create!(members: [ 'Dave' ]) end let!(:new_order) do Band.create!(members: [ 'Peter' ]) end let!(:smiths) do Band.create! end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/mongo/documents_loader_spec.rb
Ruby
mit
3,920
master
5,080
# frozen_string_literal: true require 'spec_helper' require 'concurrent-ruby' describe Mongoid::Contextual::Mongo::DocumentsLoader do let(:view) do double('view').tap do |view| allow(view).to receive(:map) end end let(:klass) do double end let(:criteria) do double('criteria').tap do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/aggregable/memory_spec.rb
Ruby
mit
3,920
master
12,100
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::Aggregable::Memory do let(:context) do Mongoid::Contextual::Memory.new(criteria) end describe '#aggregates' do subject { context.aggregates(:likes) } context 'when no documents found' do let(:criteria) do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/aggregable/mongo_spec.rb
Ruby
mit
3,920
master
14,165
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::Aggregable::Mongo do describe '#aggregates' do context 'when provided a single field' do let!(:depeche) do Band.create!(name: 'Depeche Mode', likes: 1000, years: 1000) end let!(:tool) do Band.cre...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/aggregable/none_spec.rb
Ruby
mit
3,920
master
1,024
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::Aggregable::None do before do Band.create!(name: 'Depeche Mode') end let(:context) do Mongoid::Contextual::None.new(Band.where(name: 'Depeche Mode')) end describe '#aggregates' do it 'returns fixed values' do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/contextual/aggregable/memory_table_spec.rb
Ruby
mit
3,920
master
1,635
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Contextual::Aggregable::Memory do let(:criteria) do Band.all.tap do |crit| crit.documents = documents end end let(:context) do Mongoid::Contextual::Memory.new(criteria) end file = File.read(File.join(File.dirname(__FIL...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/indexable/specification_spec.rb
Ruby
mit
3,920
master
6,160
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Indexable::Specification do describe '#==' do context 'when the keys are different' do let(:spec_one) do described_class.new(Band, { name: 1 }) end let(:spec_two) do described_class.new(Band, { title: 1 }) ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/matcher/extract_attribute_spec.rb
Ruby
mit
3,920
master
802
# frozen_string_literal: true require 'spec_helper' describe 'Matcher.extract_attribute' do Dir[File.join(File.dirname(__FILE__), 'extract_attribute_data', '*.yml')].sort.each do |path| context File.basename(path) do specs = YAML.safe_load(File.read(path), aliases: true) specs.each do |spec| ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/true_class_spec.rb
Ruby
mit
3,920
master
695
# frozen_string_literal: true 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 FalseClass' do it 'ret...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/time_spec.rb
Ruby
mit
3,920
master
17,928
# frozen_string_literal: true 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 local time is not obse...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/false_class_spec.rb
Ruby
mit
3,920
master
699
# frozen_string_literal: true 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 FalseClass' do it 'r...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/regexp_spec.rb
Ruby
mit
3,920
master
1,893
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Extensions::Regexp do %i[mongoize demongoize].each do |method| describe ".#{method}" do context 'when providing a regex' do let(:value) do Regexp.send(method, /[^abc]/) end it 'returns the provided val...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/integer_spec.rb
Ruby
mit
3,920
master
2,989
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Extensions::Integer do let(:number) do 118_347_652_312_341 end describe '#__mongoize_time__' do let(:integer) do 1_335_532_685 end let(:mongoized) do integer.__mongoize_time__ end let(:expected_time) { T...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/stringified_symbol_spec.rb
Ruby
mit
3,920
master
1,869
# frozen_string_literal: true 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 context 'when the o...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/array_spec.rb
Ruby
mit
3,920
master
6,952
# frozen_string_literal: true 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 let(:array) do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/object_id_spec.rb
Ruby
mit
3,920
master
22,066
# frozen_string_literal: true 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_object_id__).to eq(object...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/date_class_mongoize_spec.rb
Ruby
mit
3,920
master
7,929
# frozen_string_literal: true 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(:expected) do Time.utc...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/nil_class_spec.rb
Ruby
mit
3,920
master
212
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Extensions::NilClass do describe '#collectionize' do it "returns ''" do expect(nil.collectionize).to be_empty end end end
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/string_spec.rb
Ruby
mit
3,920
master
7,593
# frozen_string_literal: true 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 'when the string is a le...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/object_spec.rb
Ruby
mit
3,920
master
1,936
# frozen_string_literal: true 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_id__' do it 'retu...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/symbol_spec.rb
Ruby
mit
3,920
master
756
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Extensions::Symbol do %i[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')).to eq(:test) en...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/float_spec.rb
Ruby
mit
3,920
master
3,128
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Extensions::Float do let(:number) do 118.345 end describe '#__mongoize_time__' do let(:float) do 1_335_532_685.123457 end let(:mongoized) do float.__mongoize_time__ end let(:expected_time) { Time.at(floa...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/date_spec.rb
Ruby
mit
3,920
master
2,628
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Extensions::Date do describe '__mongoize_time__' do context 'when setting ActiveSupport time zone' do include_context 'setting ActiveSupport time zone' let(:date) do Date.new(2010, 1, 1) end let(:expected_tim...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/decimal128_spec.rb
Ruby
mit
3,920
master
942
# frozen_string_literal: true 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(decimal128) end end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/big_decimal_spec.rb
Ruby
mit
3,920
master
18,535
# frozen_string_literal: true 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' do let(:demo...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/set_spec.rb
Ruby
mit
3,920
master
2,950
# frozen_string_literal: true 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 expect(Set.mongoize(...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/binary_spec.rb
Ruby
mit
3,920
master
1,676
# frozen_string_literal: true 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 %i[mongoize demongoize].each do |method| describe ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/date_time_spec.rb
Ruby
mit
3,920
master
2,183
# frozen_string_literal: true 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:42:15.123457') en...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/raw_value_spec.rb
Ruby
mit
3,920
master
1,408
# frozen_string_literal: true 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 expect(subject).to eq 'Hello Worl...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/range_spec.rb
Ruby
mit
3,920
master
8,594
# frozen_string_literal: true 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 expect(subject)....
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/time_with_zone_spec.rb
Ruby
mit
3,920
master
9,222
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Extensions::TimeWithZone 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 local time is ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/module_spec.rb
Ruby
mit
3,920
master
782
# frozen_string_literal: true 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_method('sing') do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/boolean_spec.rb
Ruby
mit
3,920
master
3,018
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Boolean do %i[mongoize demongoize].each do |method| describe ".#{method}" do context 'when provided a boolean' do context 'when provided true' do it 'returns true' do expect(described_class.send(method, tru...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/extensions/hash_spec.rb
Ruby
mit
3,920
master
5,443
# frozen_string_literal: true 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 } end let(...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/relations/proxy_spec.rb
Ruby
mit
3,920
master
2,831
# frozen_string_literal: true # require "spec_helper" # # describe Mongoid::Relations::Proxy do # # describe '#with' do # # let(:circus) do # Circus.new # end # # let(:animal) do # Animal.new # end # # before do # circus.animals << animal # circus.save! # end # # i...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/nested_attributes_metadata_not_found_spec.rb
Ruby
mit
3,920
master
771
# frozen_string_literal: true 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( "Could not fi...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/mongoid_error_spec.rb
Ruby
mit
3,920
master
1,849
# frozen_string_literal: true 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' }.each do |key, ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_clients_config_spec.rb
Ruby
mit
3,920
master
685
# frozen_string_literal: true 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 provided.' ) ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/unsupported_javascript_spec.rb
Ruby
mit
3,920
master
772
# frozen_string_literal: true 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 include( 'Executi...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/document_not_destroyed_spec.rb
Ruby
mit
3,920
master
767
# frozen_string_literal: true 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 expect(error.message).to i...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_path_spec.rb
Ruby
mit
3,920
master
612
# frozen_string_literal: true 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 for Address') end...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_metadata_spec.rb
Ruby
mit
3,920
master
642
# frozen_string_literal: true 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 document of type Address.')...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/delete_restriction_spec.rb
Ruby
mit
3,920
master
737
# frozen_string_literal: true 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( "Cannot destroy Person b...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/readonly_attribute_spec.rb
Ruby
mit
3,920
master
745
# frozen_string_literal: true 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( "Attempted to set the readonly...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/unsaved_document_spec.rb
Ruby
mit
3,920
master
788
# frozen_string_literal: true 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 'contains the problem in the ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/mixed_client_configuration_spec.rb
Ruby
mit
3,920
master
728
# frozen_string_literal: true 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 include( 'Both uri ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_field_type_spec.rb
Ruby
mit
3,920
master
1,478
# frozen_string_literal: true 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(Person, :first_name, ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/unknown_attribute_spec.rb
Ruby
mit
3,920
master
714
# 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 fo...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_includes_spec.rb
Ruby
mit
3,920
master
909
# frozen_string_literal: true 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(klass, args) end ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/scope_overwrite_spec.rb
Ruby
mit
3,920
master
763
# frozen_string_literal: true 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 create scope :scope,...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_find_spec.rb
Ruby
mit
3,920
master
688
# frozen_string_literal: true 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 nil is invalid' ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_set_polymorphic_relation_spec.rb
Ruby
mit
3,920
master
402
# frozen_string_literal: true 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 include( "The po...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_map_reduce_output_spec.rb
Ruby
mit
3,920
master
731
# frozen_string_literal: true 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 location was specified...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/mixed_relations_spec.rb
Ruby
mit
3,920
master
725
# frozen_string_literal: true 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( 'Referencing a(n) Address docume...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/inverse_not_found_spec.rb
Ruby
mit
3,920
master
752
# frozen_string_literal: true 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 include( 'When a...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_parent_spec.rb
Ruby
mit
3,920
master
730
# frozen_string_literal: true 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 embedded document Address wi...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/too_many_nested_attribute_records_spec.rb
Ruby
mit
3,920
master
756
# frozen_string_literal: true 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( 'Accepting neste...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_index_spec.rb
Ruby
mit
3,920
master
729
# frozen_string_literal: true 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( 'Invalid in...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/validations_spec.rb
Ruby
mit
3,920
master
1,024
# frozen_string_literal: true 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 let(:error) do de...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/attribute_not_loaded_spec.rb
Ruby
mit
3,920
master
751
# frozen_string_literal: true 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( "Attempted to access attribut...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_collection_spec.rb
Ruby
mit
3,920
master
843
# frozen_string_literal: true 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 in the message' do ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_client_database_spec.rb
Ruby
mit
3,920
master
771
# frozen_string_literal: true 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).to include( ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_environment_spec.rb
Ruby
mit
3,920
master
668
# frozen_string_literal: true 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 determine the environment' ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_time_spec.rb
Ruby
mit
3,920
master
725
# frozen_string_literal: true 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 is not a date' is not...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_client_hosts_spec.rb
Ruby
mit
3,920
master
756
# frozen_string_literal: true 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 include( 'No ho...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/ambiguous_relationship_spec.rb
Ruby
mit
3,920
master
795
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Errors::AmbiguousRelationship do describe '#message' do let(:error) do described_class.new(Person, Drug, :person, %i[drugs evil_drugs]) end it 'contains the problem in the message' do expect(error.message).to include( ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_options_spec.rb
Ruby
mit
3,920
master
757
# frozen_string_literal: true 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( 'Invalid option :i...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/callback_spec.rb
Ruby
mit
3,920
master
735
# frozen_string_literal: true 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! on Post resulted in ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/no_client_config_spec.rb
Ruby
mit
3,920
master
745
# frozen_string_literal: true 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 configuration could be found fo...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_field_spec.rb
Ruby
mit
3,920
master
878
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Errors::InvalidField do describe '#message' do module MyModule def crazy_method self end end before do Object.include MyModule end let(:error) do described_class.new(Person, :crazy_method, :cr...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/document_not_found_spec.rb
Ruby
mit
3,920
master
5,045
# frozen_string_literal: true 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 expect(error.message).to ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_storage_options_spec.rb
Ruby
mit
3,920
master
740
# frozen_string_literal: true 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( 'Invalid options pass...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_config_option_spec.rb
Ruby
mit
3,920
master
702
# frozen_string_literal: true 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 configuration option...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_field_option_spec.rb
Ruby
mit
3,920
master
744
# frozen_string_literal: true 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.message).to include( ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_relation_spec.rb
Ruby
mit
3,920
master
879
# frozen_string_literal: true require 'spec_helper' describe Mongoid::Errors::InvalidRelation do describe '#message' do module MyModule def crazy_method self end end before do Object.include MyModule end let(:error) do described_class.new(Person, :crazy_method) ...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_scope_spec.rb
Ruby
mit
3,920
master
685
# frozen_string_literal: true 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 of value {} on Band i...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/readonly_document_spec.rb
Ruby
mit
3,920
master
720
# frozen_string_literal: true 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 persist a readonly docume...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/errors/invalid_config_file_spec.rb
Ruby
mit
3,920
master
706
# frozen_string_literal: true 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 configuration file: /my...
github
mongodb/mongoid
https://github.com/mongodb/mongoid
spec/mongoid/validatable/presence_spec.rb
Ruby
mit
3,920
master
13,240
# frozen_string_literal: true require 'spec_helper' require_relative '../association/referenced/has_one_models' describe Mongoid::Validatable::PresenceValidator do describe '#validate_each' do let(:product) do Product.new end let(:validator) do described_class.new(attributes: product.attrib...