Module Spec::Example::ExampleMethods
In: vendor/plugins/rspec/lib/spec/example/example_methods.rb

Methods

Included Modules

ModuleInclusionWarnings Matchers Pending

Constants

PENDING_EXAMPLE_BLOCK = lambda { raise Spec::Example::ExamplePendingError.new("Not Yet Implemented")

Public Instance methods

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 69
69:       def __full_description
70:         "#{self.class.description} #{self.description}"
71:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 65
65:       def description
66:         @_defined_description || ::Spec::Matchers.generated_description || "NO NAME"
67:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 82
82:       def eval_block
83:         return instance_eval(&(@_implementation || PENDING_EXAMPLE_BLOCK))
84:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 13
13:       def execute(options, instance_variables)
14:         options.reporter.example_started(self)
15:         set_instance_variables_from_hash(instance_variables)
16:         
17:         execution_error = nil
18:         Timeout.timeout(options.timeout) do
19:           begin
20:             before_example
21:             eval_block
22:           rescue Exception => e
23:             execution_error ||= e
24:           end
25:           begin
26:             after_example
27:           rescue Exception => e
28:             execution_error ||= e
29:           end
30:         end
31: 
32:         options.reporter.example_finished(self, execution_error)
33:         success = execution_error.nil? || ExamplePendingError === execution_error
34:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 86
86:       def implementation_backtrace
87:         eval("caller", @_implementation)
88:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 36
36:       def instance_variable_hash
37:         instance_variables.inject({}) do |variable_hash, variable_name|
38:           variable_hash[variable_name] = instance_variable_get(variable_name)
39:           variable_hash
40:         end
41:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 73
73:       def set_instance_variables_from_hash(ivars)
74:         ivars.each do |variable_name, value|
75:           # Ruby 1.9 requires variable.to_s on the next line
76:           unless ['@_implementation', '@_defined_description', '@_matcher_description', '@method_name'].include?(variable_name.to_s)
77:             instance_variable_set variable_name, value
78:           end
79:         end
80:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 43
43:       def violated(message="")
44:         raise Spec::Expectations::ExpectationNotMetError.new(message)
45:       end

Protected Instance methods

[Source]

     # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 99
 99:       def after_example
100:         self.class.run_after_each(self)
101:         verify_mocks_for_rspec
102:       ensure
103:         teardown_mocks_for_rspec
104:       end

[Source]

    # File vendor/plugins/rspec/lib/spec/example/example_methods.rb, line 94
94:       def before_example
95:         setup_mocks_for_rspec
96:         self.class.run_before_each(self)
97:       end

[Validate]