module DataModel # Test data around time schemas module Fixtures::Time include Fixtures extend self # @return [Time] a time that is used by the #earliest example def earliest_time return ::Time.now - 1 end # @return [Time] a time that is used by the #latest example def latest_time return ::Time.now + 1 end # @return [Hash{Symbol => untyped}] the variants used by each example def variants now = ::Time.now { time: now, string: [now.strftime("%H:%M:%S.%6N"), now], invalid: "invalid", early: earliest_time - 1, late: latest_time + 1, missing: nil } end # A simple time schema # @return [Example] the example def simple Example.new([:time], variants:) end # A time schema that is optional # @return [Example] the example def optional Example.new([:time, { optional: true }], variants:) end # A time schema that has a restriction on the earliest time # @return [Example] the example def earliest Example.new([:time, { earliest: earliest_time }], variants:) end # A time schema that has a restriction on the latest time # @return [Example] the example def latest Example.new([:time, { latest: latest_time }], variants:) end end end