Sha256: 86de8222db015303a7ca3b42eea165f367451fba47b8ee52091a2aa3bc98bd10
Contents?: true
Size: 985 Bytes
Versions: 1
Compression:
Stored size: 985 Bytes
Contents
# frozen_string_literal: true require_relative '../../test_helper' class TestFakerBirthdayInLeapYear < Test::Unit::TestCase def setup @tester = Faker::Date @today = Date.parse('2016-02-29') @min = 18 @max = 65 end def teardown Timecop.return end def test_birthday_in_leap_year Timecop.freeze(@today) assert_nothing_raised ArgumentError do @tester.birthday end # The error raised here is changed in Ruby 2.7. if RUBY_VERSION < '2.7' assert_raise ArgumentError do ::Date.new(@today.year - @min, @today.month, @today.day) end assert_raise ArgumentError do ::Date.new(@today.year - @max, @today.month, @today.day) end elsif RUBY_VERSION >= '2.7' assert_raise Date::Error do ::Date.new(@today.year - @min, @today.month, @today.day) end assert_raise Date::Error do ::Date.new(@today.year - @max, @today.month, @today.day) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-output-scalyr-0.1.7 | vendor/bundle/jruby/2.5.0/bundler/gems/faker-e1bd4a5a5777/test/faker/default/test_faker_birthday_in_leap_year.rb |