Class: RSpecStepwise::WholeListExample

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

Instance Method Summary collapse

Constructor Details

#initialize(example_group_class, descriptions, metadata) ⇒ WholeListExample

Returns a new instance of WholeListExample.



16
17
18
19
20
# File 'lib/rspec-steps/stepwise.rb', line 16

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

Instance Method Details

#build_example_blockObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rspec-steps/stepwise.rb', line 30

def build_example_block
  #variables of concern: reporter, instance
  reporter = @reporter
  @example_block = proc do
    begin
      self.class.filtered_examples.inject(true) do |success, example|
        if RSpec.respond_to? :wants_to_quit
          break if RSpec.wants_to_quit
        else
          break if RSpec.world.wants_to_quit
        end
        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
        if self.class.fail_fast? && !succeeded
          if RSpec.respond_to? :wants_to_quit=
            RSpec.wants_to_quit = true
          else
            RSpec.world.wants_to_quit = true
          end
        end
        success && succeeded
      end
    end
  end
end

#finish(reporter) ⇒ Object



26
27
28
# File 'lib/rspec-steps/stepwise.rb', line 26

def finish(reporter)
  super(@reporter)
end

#start(reporter) ⇒ Object



22
23
24
# File 'lib/rspec-steps/stepwise.rb', line 22

def start(reporter)
  super(@reporter)
end