Method: ContextState#process
- Defined in:
- lib/mspec/runner/context.rb
#process ⇒ Object
Evaluates the examples in a ContextState. Invokes the MSpec events for :enter, :before, :after, :leave.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/mspec/runner/context.rb', line 191 def process MSpec.register_current self if @parsed and filter_examples MSpec.shuffle @examples if MSpec.randomize? MSpec.actions :enter, description if protect "before :all", pre(:all) @examples.each do |state| MSpec.repeat do @state = state example = state.example MSpec.actions :before, state if protect "before :each", pre(:each) MSpec.clear_expectations if example passed = protect nil, example MSpec.actions :example, state, example protect nil, @expectation_missing unless MSpec.expectation? or not passed end protect "after :each", post(:each) protect "Mock.verify_count", @mock_verify end protect "Mock.cleanup", @mock_cleanup MSpec.actions :after, state @state = nil end end protect "after :all", post(:all) else protect "Mock.cleanup", @mock_cleanup end MSpec.actions :leave end MSpec.register_current nil children.each { |child| child.process } end |