Module: Sapphire::Testing::TestRunnerAdapter

Included in:
DSL::Scenarios::Scenario
Defined in:
lib/sapphire/Testing/TestRunnerAdapter.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/sapphire/Testing/TestRunnerAdapter.rb', line 11

def execute()
  Report do |reporter| reporter.ScenarioStart(self) end

  self.backgrounds.each do |background|

    background.execute

    background.and.each do |background_and|

      background_and.execute

    end

  end

  self.givens.each do |given|
    given.when.each do |when_|

      if when_.value.is_a? Pending
        given.pend()

        given.and.each do |given_and|

          given_and.pend()

        end
      else
        given.execute()

        given.and.each do |given_and|

          given_and.execute()

        end
      end

      when_.execute

      when_.and.each do |when_and|

        when_and.execute

      end

      when_.then.each do |then_|

        then_.execute

        then_.and.each do |then_and|

          then_and.execute

        end

      end

    end

    if(given.finally)

      given.finally.execute

    end

  end

  Report do |reporter| reporter.ScenarioComplete(self) end

end

#Report(&block) ⇒ Object



5
6
7
8
9
# File 'lib/sapphire/Testing/TestRunnerAdapter.rb', line 5

def Report(&block)
  $instances.each do |reporter|
    block.call reporter
  end
end