Sha256: dcd62544f5d664b142bb97a2f5e3e780e189c2ff8b31141174d064af4733b005

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

require_relative '../../test_helper'

class TestFakerComputer < Test::Unit::TestCase
  def setup
    @tester = Faker::Computer
    @platforms = Faker::Base.fetch_all('computer.platform')
  end

  def test_type
    assert @tester.type.match(/\w+/)
  end

  def test_platform
    assert @tester.platform.match(/(\w+ ?){1,3}/)
  end

  def test_stack
    # puts @tester.stack
    assert stack = @tester.stack
                          .match(/\A(?<platform>(?:[[:alnum:]]+\s?){1,5}), (?<os>(?:[[:alnum:]]+-?.?\)?\(?\s?){1,5})\z/)

    platform = stack[:platform]
    search_format_platform = platform.downcase
    os = stack[:os]

    oses = Faker::Base.fetch_all("computer.os.#{search_format_platform}")

    assert @platforms.include?(platform)
    assert oses.include?(os)
  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_computer.rb