Class: Spec::Example::ExampleProxy
- Defined in:
- lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb
Overview
Lightweight proxy for an example. This is the object that is passed to example-related methods in Spec::Runner::Formatter::BaseFormatter
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
This is the docstring passed to the
it()
method or any of its aliases. -
#location ⇒ Object
readonly
The file and line number at which the represented example was declared.
-
#options ⇒ Object
readonly
Optional hash passed to the example declaration.
Instance Method Summary collapse
-
#==(other) ⇒ Object
:nodoc:.
-
#backtrace ⇒ Object
Deprecated - use location().
-
#initialize(description = nil, options = {}, location = nil) ⇒ ExampleProxy
constructor
:nodoc:.
-
#update(description) ⇒ Object
Convenience method for example group - updates the value of
description
and returns self.
Constructor Details
#initialize(description = nil, options = {}, location = nil) ⇒ ExampleProxy
:nodoc:
7 8 9 |
# File 'lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb', line 7 def initialize(description=nil, ={}, location=nil) # :nodoc: @description, @options, @location = description, , location end |
Instance Attribute Details
#description ⇒ Object (readonly)
This is the docstring passed to the it()
method or any of its aliases
16 17 18 |
# File 'lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb', line 16 def description @description end |
#location ⇒ Object (readonly)
The file and line number at which the represented example was declared. This is extracted from caller
, and is therefore formatted as an individual line in a backtrace.
21 22 23 |
# File 'lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb', line 21 def location @location end |
#options ⇒ Object (readonly)
Optional hash passed to the example declaration
12 13 14 |
# File 'lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb', line 12 def @options end |
Instance Method Details
#==(other) ⇒ Object
:nodoc:
36 37 38 |
# File 'lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb', line 36 def ==(other) # :nodoc: (other.description == description) & (other.location == location) end |
#backtrace ⇒ Object
Deprecated - use location()
24 25 26 27 |
# File 'lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb', line 24 def backtrace Spec.deprecate("ExampleProxy#backtrace","ExampleProxy#location") location end |
#update(description) ⇒ Object
Convenience method for example group - updates the value of description
and returns self.
31 32 33 34 |
# File 'lib/vendor/plugins/rspec/lib/spec/example/example_proxy.rb', line 31 def update(description) # :nodoc: @description = description self end |