Sha256: 141124b7b1282b76c3b954ba0d7b3768bb3e6b4a182140375340ea281c03cd26

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

require_relative '../../test_helper'

class TestFakerFile < Test::Unit::TestCase
  def setup
    @tester = Faker::File
  end

  def test_extension
    assert @tester.extension.match(/(flac|mp3|wav|bmp|gif|jpeg|jpg|png|tiff|css|csv|html|js|json|txt|mp4|avi|mov|webm|doc|docx|xls|xlsx|ppt|pptx|odt|ods|odp|pages|numbers|key|pdf)/)
  end

  def test_mime_type_format
    assert @tester.mime_type.match(%r{(.*)/(.*)+})
  end

  def test_file_name
    assert @tester
      .file_name
      .match(%r{^([a-z\-_.]+)(\\|/)([a-z\-_]+)\.([a-z]+)$})
  end

  def test_dir
    assert @tester.dir.match(%r{^(([a-z\-_.]+)(\\|/)){2}([a-z\-_.]+)$})
  end

  def test_dir_with_args
    assert @tester
      .dir(segment_count: 2, root: '\\root\\', directory_separator: '\\')
      .match(%r{^\\root(\\([a-z\-_.]+)){2}$})
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-output-scalyr-0.1.7 vendor/bundle/jruby/2.5.0/bundler/gems/faker-e1bd4a5a5777/test/faker/default/test_faker_file.rb