Class: RSpecStepwise::WholeListExample

Inherits:
RSpec::Core::Example
  • Object
show all
Defined in:
lib/two-step/stepwise.rb

Instance Method Summary collapse

Constructor Details

#initialize(example_group_class, descriptions, metadata) ⇒ WholeListExample

Returns a new instance of WholeListExample.



9
10
11
12
13
# File 'lib/two-step/stepwise.rb', line 9

def initialize(example_group_class, descriptions, )
  super
  @reporter = ApatheticReporter.new
  build_example_block
end

Instance Method Details

#build_example_blockObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/two-step/stepwise.rb', line 23

def build_example_block
  #variables of concern: reporter, instance
  @example_block = proc do
    begin
      self.class.filtered_examples.inject(true) do |success, example|
        break if RSpec.wants_to_quit
        example.extend StepExample
        unless success
          example.[:pending] = true
          example.[:execution_result][:pending_message] = "Previous step failed"
        end
        succeeded = with_indelible_ivars do
          example.run(self, reporter)
        end
        RSpec.wants_to_quit = true if self.class.fail_fast? && !succeeded
        success && succeeded
      end
    end
  end
end

#finish(reporter) ⇒ Object



19
20
21
# File 'lib/two-step/stepwise.rb', line 19

def finish(reporter)
  super(@reporter)
end

#start(reporter) ⇒ Object



15
16
17
# File 'lib/two-step/stepwise.rb', line 15

def start(reporter)
  super(@reporter)
end