Sha256: 0e5ff260996f287cb9e92a6405a110e2b236566cb54f44996da0bd8c43781b42

Contents?: true

Size: 814 Bytes

Versions: 3

Compression:

Stored size: 814 Bytes

Contents

# Author::    Nicolas Despres  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /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.3.1.2 lib/uttk/strategies/Sleep.rb
uttk-0.3.6.1 lib/uttk/strategies/Sleep.rb
uttk-0.3.5.0 lib/uttk/strategies/Sleep.rb