1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# 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_match(/\w+/, @tester.type)
end
def test_platform
assert_match(/(\w+ ?\d?){1,3}/, @tester.platform)
end
def test_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_includes @platforms, platform
assert_includes oses, os
end
end
|