Sha256: 8980133ffa3f311b067cd92b9630ad2b0fc69361e77c7e4d0cd418ac444244ed

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

# Author::    Nicolas Despres  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Sleep.rb 8789 2005-09-27T14:49:49.088376Z ertai  $


module Uttk

  module Strategies

    # A test strategy class that only sleep for a moment before to pass.
    class Sleep < Strategy
      include Concrete

      def delay=(other)
        other = other.to_f
        if other >= 0
          @delay = other
        else
          raise(ArgumentError, "`#{other}' - sleep delay must be >= 0")
        end
      end

      protected
      def run_impl
        sleep(@delay)
        pass
      end

      attribute :delay, 'Delay in second to sleep', 0

    end # class Sleep

  end # module Strategies

end # module Uttk

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uttk-0.4.6.1 lib/uttk/strategies/Sleep.rb
uttk-0.4.6.2 lib/uttk/strategies/Sleep.rb
uttk-0.4.5.0 lib/uttk/strategies/Sleep.rb