Sha256: 82e02990add894bc92bbd5bc79a19f4ec4909a9cab7227afe8129642cb227eb0
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true require_relative '../../test_helper' class TestFakerAvatar < Test::Unit::TestCase def setup @tester = Faker::Avatar end def test_avatar assert !@tester.image.match(%r{https://robohash\.org/(.+)\.png})[1].nil? end def test_avatar_with_param assert @tester.image(slug: 'faker').match(%r{https://robohash\.org/(.+)\.png})[1] == 'faker' end def test_avatar_with_correct_size assert @tester.image(slug: 'faker', size: '150x320').match(%r{https://robohash\.org/faker\.png\?size=(.+)&.*})[1] == '150x320' end def test_avatar_with_incorrect_size assert_raise ArgumentError do @tester.image(slug: nil, size: '150x320z') end end def test_avatar_with_supported_format assert @tester.image(slug: 'faker', size: '300x300', format: 'jpg').match(%r{https://robohash\.org/faker\.jpg}) end def test_avatar_with_incorrect_format assert_raise ArgumentError do @tester.image(slug: nil, size: '300x300', format: 'wrong_format') end end def test_avatar_with_set assert @tester.image(slug: 'faker', size: '300x300', format: 'jpg', set: 'set2').match(%r{https://robohash\.org/faker\.jpg.*set=set2}) end def test_avatar_with_bgset assert @tester.image(slug: 'faker', size: '300x300', format: 'jpg', set: 'set1', bgset: 'bg1').match(%r{https://robohash\.org/faker\.jpg.*bgset=bg1}) 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_avatar.rb |