Sha256: 1632faa53579ddfba814f61b5c0df269927c269a4362c280ae924ae5648524e3

Contents?: true

Size: 428 Bytes

Versions: 2

Compression:

Stored size: 428 Bytes

Contents

RSpec::Matchers.define :allow_file_content_type do |content_type, validator, message|
  match do |model|
    value = double('file', content_type: content_type)
    model.any_instance.stub(:read_attribute_for_validation).and_return(value)
    dummy = model.new
    validator.validate(dummy)
    if message.present?
      dummy.errors.full_messages.exclude?(message[:message])
    else
      dummy.errors.empty?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
file_validators-1.1.0 spec/support/matchers/allow_content_type.rb
file_validators-1.0.0 spec/support/matchers/allow_content_type.rb