File: test_faker_relationship.rb

package info (click to toggle)
ruby-faker 3.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,596 kB
  • sloc: ruby: 20,656; sh: 6; makefile: 6
file content (44 lines) | stat: -rw-r--r-- 879 bytes parent folder | download
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
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true

require_relative '../../test_helper'

class TestFakerRelationship < Test::Unit::TestCase
  def setup
    @tester = Faker::Relationship
  end

  def test_random_familial
    assert_match(/\w+/, @tester.familial)
  end

  def test_familial_direct
    assert_match(/\w+/, @tester.familial(connection: 'direct'))
  end

  def test_familial_extended
    assert_match(/\w+/, @tester.familial(connection: 'extended'))
  end

  # test error on no match
  def test_invalid_familial_connection
    assert_raise ArgumentError do
      @tester.familial(connection: 'Not Correct')
    end
  end

  def test_in_law
    assert_match(/\w+/, @tester.in_law)
  end

  def test_spouse
    assert_match(/\w+/, @tester.spouse)
  end

  def test_parent
    assert_match(/\w+/, @tester.parent)
  end

  def test_sibling
    assert_match(/\w+/, @tester.sibling)
  end
end