Sha256: 59129d9e2c4eaf11384e86a77ed35e8ac65423b61b1f989df16838afc9229da3
Contents?: true
Size: 1.18 KB
Versions: 9
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true require_relative 'helper' class TestUniqueUtils < Test::Unit::TestCase def test_generates_unique_values unique_object = FFakerTW::UniqueUtils.new(FFakerTW::Name, 10_000) result = [unique_object.name, unique_object.name] assert_operator(result[0], :!=, result[1]) end def test_returns_error_when_retries_exceeded stubbed_generator = Object.new def stubbed_generator.test 1 end unique_object = FFakerTW::UniqueUtils.new(stubbed_generator, 3) unique_object.test assert_raises FFakerTW::UniqueUtils::RetryLimitExceeded do unique_object.test end end def test_clears_unique_values stubbed_generator = Object.new def stubbed_generator.test 1 end unique_object = FFakerTW::UniqueUtils.new(stubbed_generator, 3) assert_equal(1, unique_object.test) assert_raises FFakerTW::UniqueUtils::RetryLimitExceeded do unique_object.test end FFakerTW::UniqueUtils.clear assert_equal(1, unique_object.test) assert_raises FFakerTW::UniqueUtils::RetryLimitExceeded do unique_object.test end unique_object.clear assert_equal(1, unique_object.test) end end
Version data entries
9 entries across 9 versions & 1 rubygems