Sha256: 6fa232ec54443a9cfd77a7385b32769df9e70ed8680472a65f95e3f0739ccd63

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'helper'

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

  assert_methods_are_deterministic(
    FFaker::NatoAlphabet,
    :code, :alphabetic_code, :numeric_code, :callsign
  )

  def setup
    @tester = FFaker::NatoAlphabet
  end

  def test_code
    assert FFaker::NatoAlphabet::CODES.include?(@tester.code)
  end

  def test_letter_code
    assert FFaker::NatoAlphabet::ALPHABET_CODES.include?(@tester.alphabetic_code)
  end

  def test_numerify_code
    assert FFaker::NatoAlphabet::NUMERIC_CODES.include?(@tester.numeric_code)
  end

  def test_callsign
    assert_match(/[A-Z]+-[A-Z]+-[A-Z]+/, @tester.callsign)
  end

  def test_codify
    assert_match(/[A-Z]+-[A-Z]+-[A-Z]+/, @tester.codify('?-?-?'))
    assert_match(/[A-Z]+-[A-Z]+-[A-Z]+/, @tester.codify('?-#-?'))
    assert_match(FFaker::NatoAlphabet::STOP_CODE, @tester.codify('.'))

    assert_deterministic { @tester.codify('?-?-?') }
    assert_deterministic { @tester.codify('?-#-?') }
    assert_deterministic { @tester.codify('.') }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ffaker-2.18.0 test/test_nato_alphabet.rb
ffaker-2.17.0 test/test_nato_alphabet.rb
ffaker-2.16.0 test/test_nato_alphabet.rb
ffaker-2.15.0 test/test_nato_alphabet.rb
ffaker-2.14.0 test/test_nato_alphabet.rb
ffaker-2.13.0 test/test_nato_alphabet.rb
ffaker-2.12.0 test/test_nato_alphabet.rb