spec/mongoid/association/macros_spec.rb in mongoid-7.0.0.beta vs spec/mongoid/association/macros_spec.rb in mongoid-7.0.0

- old
+ new

@@ -18,9 +18,29 @@ after do klass.relations.clear klass.validators.clear end + describe 'Model loading' do + + let(:model_associations) do + class TestModel + include Mongoid::Document + field :associations + end + end + + after do + Object.send(:remove_const, :TestModel) + end + + it 'prohibits the use of :associations as an attribute' do + expect { + model_associations + }.to raise_exception(Mongoid::Errors::InvalidField) + end + end + describe ".embedded_in" do it "defines the macro" do expect(klass).to respond_to(:embedded_in) end