Sha256: d8aad90a1f675467fb763d516dd47728310d9ccf0d8a7a0f79e462890d2a5c86

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

require_relative "test_helper"

class TestRandomData < Test::Unit::TestCase


    def setup
      # to make random numbers deterministic for testing purposes
      srand(100)
    end

    def test_invoice_tests
      sites = %w{cr ec pa pe ve mx co cl ar br}
      sites.each { |site|

        assert invoice = Random.invoice_data_for(site)
        invoice.each do |key, value|
          if value.is_a?(Hash)
            value.each do |k,v|
              assert k, "#{value}"  if k
              assert v, "#{value}"
            end
          else
            assert value,"#{invoice}"
          end
        end
      }
    end

    def test_id_for_site_tests
      sites = %w{cr ec pa pe ve mx co cl ar br}
      sites.each { |site|
        assert Random.id_for(site), "#{site}"
      }
      assert Random.argentinean_cuil, "Cuil generator failed"
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
random_data_despegar-2.1 test/test_id_invoice_tests.rb