diff options
Diffstat (limited to 'spec/lib/file_size_validator_spec.rb')
-rw-r--r-- | spec/lib/file_size_validator_spec.rb | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/spec/lib/file_size_validator_spec.rb b/spec/lib/file_size_validator_spec.rb deleted file mode 100644 index 5c89c854714..00000000000 --- a/spec/lib/file_size_validator_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'spec_helper' - -describe 'Gitlab::FileSizeValidatorSpec' do - let(:validator) { FileSizeValidator.new(options) } - let(:attachment) { AttachmentUploader.new } - let(:note) { create(:note) } - - describe 'options uses an integer' do - let(:options) { { maximum: 10, attributes: { attachment: attachment } } } - - it 'attachment exceeds maximum limit' do - allow(attachment).to receive(:size) { 100 } - validator.validate_each(note, :attachment, attachment) - expect(note.errors).to have_key(:attachment) - end - - it 'attachment under maximum limit' do - allow(attachment).to receive(:size) { 1 } - validator.validate_each(note, :attachment, attachment) - expect(note.errors).not_to have_key(:attachment) - end - end - - describe 'options uses a symbol' do - let(:options) { { maximum: :test, - attributes: { attachment: attachment } } } - before do - allow(note).to receive(:test) { 10 } - end - - it 'attachment exceeds maximum limit' do - allow(attachment).to receive(:size) { 100 } - validator.validate_each(note, :attachment, attachment) - expect(note.errors).to have_key(:attachment) - end - - it 'attachment under maximum limit' do - allow(attachment).to receive(:size) { 1 } - validator.validate_each(note, :attachment, attachment) - expect(note.errors).not_to have_key(:attachment) - end - end -end |