Sha256: 9669612c29be935256d58747a8cf8031616f491b53c6a3392cef560773fbb576

Contents?: true

Size: 678 Bytes

Versions: 2

Compression:

Stored size: 678 Bytes

Contents

module Cucumber
  module Filters

    # Batches up all test cases, randomizes them, and then sends them on
    class Randomizer
      def initialize(seed, receiver)
        @receiver = receiver
        @test_cases = []
        @seed = seed
      end

      def test_case(test_case)
        @test_cases << test_case
        self
      end

      def done
        shuffled_test_cases.each do |test_case|
          test_case.describe_to(@receiver)
        end
        @receiver.done
        self
      end

      private

      def shuffled_test_cases
        @test_cases.shuffle(random: Random.new(seed))
      end

      attr_reader :seed
      private :seed
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-2.0.0.beta.5 lib/cucumber/filters/randomizer.rb
cucumber-2.0.0.beta.4 lib/cucumber/filters/randomizer.rb