Class: Cucumber::Filters::Randomizer

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/filters/randomizer.rb

Overview

Batches up all test cases, randomizes them, and then sends them on

Instance Method Summary collapse

Constructor Details

#initialize(seed, receiver = nil) ⇒ Randomizer

Returns a new instance of Randomizer



9
10
11
12
13
# File 'lib/cucumber/filters/randomizer.rb', line 9

def initialize(seed, receiver = nil)
  @receiver = receiver
  @test_cases = []
  @seed = seed
end

Instance Method Details

#doneObject



20
21
22
23
24
25
26
# File 'lib/cucumber/filters/randomizer.rb', line 20

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

#test_case(test_case) ⇒ Object



15
16
17
18
# File 'lib/cucumber/filters/randomizer.rb', line 15

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

#with_receiver(receiver) ⇒ Object



28
29
30
# File 'lib/cucumber/filters/randomizer.rb', line 28

def with_receiver(receiver)
  self.class.new(@seed, receiver)
end