Sha256: 7eff6f57003c4beee89de7dfaa41c65868873e397b406958d147e53a70ba9c30
Contents?: true
Size: 1.15 KB
Versions: 6
Compression:
Stored size: 1.15 KB
Contents
# encoding: utf-8 require 'helper' class TestUniqueUtils < Test::Unit::TestCase def test_generates_unique_values unique_object = FFaker::UniqueUtils.new(FFaker::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 = FFaker::UniqueUtils.new(stubbed_generator, 3) unique_object.test assert_raises FFaker::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 = FFaker::UniqueUtils.new(stubbed_generator, 3) assert_equal(1, unique_object.test) assert_raises FFaker::UniqueUtils::RetryLimitExceeded do unique_object.test end FFaker::UniqueUtils.clear assert_equal(1, unique_object.test) assert_raises FFaker::UniqueUtils::RetryLimitExceeded do unique_object.test end unique_object.clear assert_equal(1, unique_object.test) end end
Version data entries
6 entries across 6 versions & 1 rubygems