1

Here is my validation:

describe User
  it { should validate_attachment_size(:avatar).less_than(20.megabytes) }
end

Here is my User model:

class User < ActiveRecord::Base
  validates_attachment :avatar, :content_type => { :content_type => /image/ }, size: { in: 0..20.megabytes }, allow_blank: true
end

The error I keep getting is:

Failure/Error: it { should validate_attachment_size(:avatar).less_than(20.megabytes) }
       Attachment avatar must be between  and 20971520 bytes

Not sure why this is failing. Any help is greatly appreciated!

dennismonsewicz
  • 25,132
  • 33
  • 116
  • 189

0 Answers0