Sha256: ff6293955651653121d9c94aa2f3ce9d9a77bf9b0420bbfc171bff87b0ba830e

Contents?: true

Size: 757 Bytes

Versions: 28

Compression:

Stored size: 757 Bytes

Contents

# -*- coding: utf-8 -*-
module GorgonBunny
  # Unit, integration and stress testing toolkit
  class TestKit
    class << self

      # @return [Integer] Random integer in the range of [a, b]
      # @api private
      def random_in_range(a, b)
        Range.new(a, b).to_a.sample
      end

      # @param  [Integer] a Lower bound of message size, in KB
      # @param  [Integer] b Upper bound of message size, in KB
      # @param  [Integer] i Random number to use in message generation
      # @return [String] Message payload of length in the given range, with non-ASCII characters
      # @api public
      def message_in_kb(a, b, i)
        s = "Ю#{i}"
        n = random_in_range(a, b) / s.bytesize

        s * n * 1024
      end

    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gorgon-0.11.1 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.11.0 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.10.5 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.10.4 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.10.3 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.10.2 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.10.1 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.10.0 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.9.0 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.8.4 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.8.3 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.8.2 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.8.1 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.8.0 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.7.1 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.7.0 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.7.0.rc4 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.7.0.rc3 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.7.0.rc2 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb
gorgon-0.7.0.rc1 lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb