File: test_units.rb

package info (click to toggle)
ruby-ffaker 2.23.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,776 kB
  • sloc: ruby: 12,788; makefile: 8; sh: 1
file content (37 lines) | stat: -rw-r--r-- 901 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
# frozen_string_literal: true

require_relative 'helper'
require 'ostruct'

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

  assert_methods_are_deterministic(
    FFaker::Unit,
    :time_name, :time_abbr, :temperature_name, :temperature_abbr
  )

  def setup
    @tester = FFaker::Unit
    @time_units = @tester::TIME_UNITS
    @temperature_units = @tester::TEMPERATURE_UNITS
  end

  def test_time_name
    assert_include @time_units.map { |unit| unit[:name] }, @tester.time_name
  end

  def test_time_abbr
    assert_include @time_units.map { |unit| unit[:abbreviation] }, @tester.time_abbr
  end

  def test_temperature_name
    assert_include @temperature_units.map { |unit| unit[:name] }, @tester.temperature_name
  end

  def test_temperature_abbr
    assert_include \
      @temperature_units.map { |unit| unit[:abbreviation] },
      @tester.temperature_abbr
  end
end