Sha256: 36a8dc25019a1159b6eb18a060c8b886f72ebdba5e65a8483707db57168bc60a
Contents?: true
Size: 1.45 KB
Versions: 21
Compression:
Stored size: 1.45 KB
Contents
# 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, :stringgy) end it "contains the problem in the message" do expect(error.message).to include( "Invalid field type :stringgy for field 'first_name' on model 'Person'." ) end it "contains the summary in the message" do expect(error.message).to include( "Model 'Person' defines a field 'first_name' with an unknown type value :stringgy." ) end end context 'when type is a string' do let(:error) do described_class.new(Person, :first_name, 'stringgy') end it "contains the problem in the message" do expect(error.message).to include( %q,Invalid field type "stringgy" for field 'first_name' on model 'Person'., ) end it "contains the summary in the message" do expect(error.message).to include( %q,Model 'Person' defines a field 'first_name' with an unknown type value "stringgy"., ) end end it "contains the resolution in the message" do expect(error.message).to include( 'Please provide a valid type value for the field.' ) end end end
Version data entries
21 entries across 21 versions & 1 rubygems