Class Spec::DSL::Example
In: lib/spec/dsl/example.rb
Parent: Object

Methods

matches?   new   run  

Public Class methods

[Source]

    # File lib/spec/dsl/example.rb, line 6
 6:       def initialize(description, options={}, &example_block)
 7:         @from = caller(0)[3]
 8:         @options = options
 9:         @example_block = example_block
10:         @description = description
11:         @description_generated_proc = lambda { |desc| @generated_description = desc }
12:       end

Public Instance methods

[Source]

    # File lib/spec/dsl/example.rb, line 32
32:       def matches?(matcher, specified_examples)
33:         matcher.example_desc = description
34:         matcher.matches?(specified_examples)
35:       end

[Source]

    # File lib/spec/dsl/example.rb, line 14
14:       def run(reporter, before_each_block, after_each_block, dry_run, execution_context, timeout=nil)
15:         @dry_run = dry_run
16:         reporter.example_started(description)
17:         return reporter.example_finished(description) if dry_run
18: 
19:         errors = []
20:         location = nil
21:         Timeout.timeout(timeout) do
22:           before_each_ok = setup_example(execution_context, errors, &before_each_block)
23:           example_ok = run_example(execution_context, errors) if before_each_ok
24:           after_each_ok = teardown_example(execution_context, errors, &after_each_block)
25:           location = failure_location(before_each_ok, example_ok, after_each_ok)
26:         end
27: 
28:         ExampleShouldRaiseHandler.new(@from, @options).handle(errors)
29:         reporter.example_finished(description, errors.first, location, @example_block.nil?) if reporter
30:       end

[Validate]