Module: PaperclipMatchers

Includes:
Rspec::Matchers
Defined in:
lib/paperclip-matchers.rb

Instance Method Summary collapse

Instance Method Details

#validate_attachment_presence(attribute) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/paperclip-matchers.rb', line 7

def validate_attachment_presence( attribute )
  Matcher.new :validate_attachment_presence, attribute do |_attribute_|
    match do |_model_|
      _model_.send("#{_attribute_}=", nil)
      !_model_.valid? && _model_.errors["#{_attribute_}_file_name".to_sym].any?
    end
  end
end