Class: RSpec::Trunk
- Inherits:
-
Object
- Object
- RSpec::Trunk
- Defined in:
- lib/trunk_spec_helper.rb
Overview
Trunk is a class that is used to monitor the execution of the Example class
Class Method Summary collapse
Instance Method Summary collapse
- #current_example ⇒ Object
-
#initialize(example) ⇒ Trunk
constructor
A new instance of Trunk.
- #run ⇒ Object
Constructor Details
#initialize(example) ⇒ Trunk
Returns a new instance of Trunk.
137 138 139 |
# File 'lib/trunk_spec_helper.rb', line 137 def initialize(example) @example = example end |
Class Method Details
.setup ⇒ Object
127 128 129 130 131 132 133 134 135 |
# File 'lib/trunk_spec_helper.rb', line 127 def self.setup RSpec.configure do |config| if trunk_disabled config.around(:each, &:run) else config.around(:each, &:run_with_trunk) end end end |
Instance Method Details
#current_example ⇒ Object
141 142 143 |
# File 'lib/trunk_spec_helper.rb', line 141 def current_example @current_example ||= RSpec.current_example end |
#run ⇒ Object
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/trunk_spec_helper.rb', line 145 def run # run the test @example.run # monitor attempts in the metadata if @example.[:attempt_number] @example.[:attempt_number] += 1 else @example.[:attempt_number] = 0 end end |