spec/adapter_spec.rb in carrierwave-base64-2.3.4 vs spec/adapter_spec.rb in carrierwave-base64-2.3.5

- old
+ new

@@ -5,10 +5,15 @@ subject do Post.mount_base64_uploader(:image, uploader) Post.new end + let(:mongoid_model) do + MongoidModel.mount_base64_uploader(:image, uploader) + MongoidModel.new + end + it 'mounts the uploader on the image field' do expect(subject.image).to be_an_instance_of(uploader) end context 'normal file uploads' do @@ -18,11 +23,11 @@ '/test.jpg', file_path('fixtures', 'test.jpg'), 'images/jpg' ) subject[:image] = 'test.jpg' end - it 'sets will_change for the attribute' do + it 'sets will_change for the attribute on activerecord models' do expect(subject.changed?).to be_truthy end it 'saves the file' do subject.save! @@ -50,9 +55,15 @@ ).to eq file_path('../uploads', 'file.jpg') end it 'sets will_change for the attribute' do expect(subject.changed?).to be_truthy + end + + it 'does not call will_change mongoid models' do + expect do + mongoid_model.image = 'test.jpg' + end.not_to raise_error end end context 'stored uploads exist for the field' do before :each do