Sha256: ad06c175d47c96c037f967ac1dc624e6fb3c2466ef60ac66a39514f54aea50d4

Contents?: true

Size: 878 Bytes

Versions: 9

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

class TestFakerFilesystem < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFakerTW::Filesystem,
    :extension, :mime_type, :file_name
  )

  def setup
    @tester = FFakerTW::Filesystem
  end

  def test_extension
    assert_match /\A(?: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)\z/x,
                 @tester.extension
  end

  def test_mime_type_format
    assert_match %r{\A\w+/.+\z}, @tester.mime_type
  end

  def test_directory
    assert_match %r{\A(?:[a-z_-]+[\\/])+[a-z_-]+\z}, @tester.directory
  end

  def test_file_name
    assert_match %r{\A(?:[a-z_-]+[\\/])+[a-z_-]+\.\w{2,4}\z},
      @tester.file_name
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffakerTW-1.8.0 test/test_filesystem.rb
ffakerTW-1.7.0 test/test_filesystem.rb
ffakerTW-1.6.0 test/test_filesystem.rb
ffakerTW-1.5.0 test/test_filesystem.rb
ffakerTW-1.4.0 test/test_filesystem.rb
ffakerTW-1.3.0 test/test_filesystem.rb
ffakerTW-1.2.0 test/test_filesystem.rb
ffakerTW-1.1.0 test/test_filesystem.rb
ffakerTW-0.1.0 test/test_filesystem.rb