Class: RSpec::Core::ExampleGroup
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
RSpec::Core::AnonymousExampleGroup
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
self,
Pending ,
MemoizedHelpers
|
|
Inherits: | Object |
Defined in: | rspec-core/lib/rspec/core/example_group.rb |
Overview
ExampleGroup
and Example
are the main structural elements of rspec-core. Consider this example:
RSpec.describe Thing do
it "does something" do
end
end
The object returned by ‘describe Thing` is a subclass of ExampleGroup
. The object returned by `it “does something”` is an instance of Example
, which serves as a wrapper for an instance of the ExampleGroup
in which it is declared.
Example
group bodies (e.g. describe
or context
blocks) are evaluated in the context of a new subclass of ExampleGroup
. Individual examples are evaluated in the context of an instance of the specific ExampleGroup
subclass to which they belong.
Besides the class methods defined here, there are other interesting macros defined in Hooks
, MemoizedHelpers::ClassMethods
and SharedExampleGroup
. There are additional instance methods available to your examples defined in MemoizedHelpers
and Pending
.
Constant Summary
-
INSTANCE_VARIABLE_TO_IGNORE =
Internal use only
# File 'rspec-core/lib/rspec/core/example_group.rb', line 692:@__inspect_output
-
WrongScopeError =
Raised when an
::RSpec
API is called in the wrong scope, such asbefore
being called from within an example rather than from within an example group block.Class.new(NoMethodError)
Pending
- Included
Metadata
- .delegate_to_metadata(*names) Internal use only Internal use only
-
#described_class
Returns the class or module passed to the
describe
method (or alias). - .description ⇒ String
-
.metadata
The [Metadata](Metadata) object associated with this group.
- .superclass_metadata ⇒ Metadata Internal use only Internal use only
-
.with_replaced_metadata(meta)
Internal use only
Internal use only
Temporarily replace the provided metadata.
Defining Examples
-
.define_example_method(name, extra_options = {})
Internal use only
Internal use only
@example.
-
.example
Defines an example within a group.
-
.fexample
Shortcut to define an example with ‘:focus => true`.
-
.fit
Shortcut to define an example with ‘:focus => true`.
-
.focus
Shortcut to define an example with ‘:focus => true`.
-
.fspecify
Shortcut to define an example with ‘:focus => true`.
-
.it
Defines an example within a group.
-
.pending
Shortcut to define an example with ‘:pending => true`.
-
.skip
Shortcut to define an example with ‘:skip => true`.
-
.specify
Defines an example within a group.
-
.xexample
Shortcut to define an example with ‘:skip => ’Temporarily skipped with xexample’‘.
-
.xit
Shortcut to define an example with ‘:skip => ’Temporarily skipped with xit’‘.
-
.xspecify
Shortcut to define an example with ‘:skip => ’Temporarily skipped with xspecify’‘.
Defining Example Groups
- .define_example_group_method(name, metadata = {}) Internal use only Internal use only
Including Shared Example Groups
-
.add_example(example)
Adds an example to the example group.
- .define_nested_shared_group_method(new_name, report_label = "it should behave like") Internal use only Internal use only
- .find_and_eval_shared(label, name, inclusion_location, *args, &customization_block) Internal use only Internal use only
-
.include_context(name, *args, &block)
Includes shared content mapped to
name
directly in the group in which it is declared, as opposed toit_behaves_like
, which creates a nested group. -
.include_examples(name, *args, &block)
Includes shared content mapped to
name
directly in the group in which it is declared, as opposed toit_behaves_like
, which creates a nested group. -
.remove_example(example)
Removes an example from the example group.
-
.reset_memoized
Internal use only
Internal use only
Clear memoized values when adding/removing examples.
Class Attribute Summary
-
.currently_executing_a_context_hook? ⇒ Boolean
readonly
Returns true if a ‘before(:context)` or
after(:context)
hook is currently executing. - .top_level? ⇒ Boolean readonly Internal use only Internal use only
Class Method Summary
- .before_context_ivars Internal use only Internal use only
- .children Internal use only Internal use only
- .declaration_locations Internal use only Internal use only
- .descendant_filtered_examples Internal use only Internal use only
- .descendants Internal use only Internal use only
- .each_instance_variable_for_example(group) Internal use only Internal use only
- .ensure_example_groups_are_configured Internal use only Internal use only
- .examples Internal use only Internal use only
- .filtered_examples Internal use only Internal use only
- .for_filtered_examples(reporter, &block) Internal use only Internal use only
- .id ⇒ String
-
.idempotently_define_singleton_method(name, &definition)
Internal use only
Internal use only
Define a singleton method for the singleton class (remove the method if it’s already been defined).
- .initialize(inspect_output = nil) Internal use only Internal use only
- .inspect Internal use only Internal use only
- .next_runnable_index_for(file) Internal use only Internal use only
- .ordering_strategy Internal use only Internal use only
- .parent_groups Internal use only Internal use only
-
.run(reporter = RSpec::Core::NullReporter)
Runs all the examples in this group.
- .run_after_context_hooks(example_group_instance) Internal use only Internal use only
- .run_before_context_hooks(example_group_instance) Internal use only Internal use only
- .run_examples(reporter) Internal use only Internal use only
- .set_it_up(description, args, registration_collection, &example_group_block) Internal use only Internal use only
- .set_ivars(instance, ivars) Internal use only Internal use only
-
.singleton_class
Internal use only
Internal use only
:nocov:
- .store_before_context_ivars(example_group_instance) Internal use only Internal use only
- .subclass(parent, description, args, registration_collection, &example_group_block) Internal use only Internal use only
-
.superclass_before_context_ivars
Internal use only
Internal use only
:nocov:
- .top_level_description Internal use only Internal use only
-
.traverse_tree_until(&block)
Internal use only
Internal use only
Traverses the tree of groups, starting with
self
, then the children, recursively. - .update_inherited_metadata(updates) Internal use only Internal use only
-
.method_missing(name, *args)
private
See additional method definition at line 742.
SharedExampleGroup
- Extended
shared_context | Alias for SharedExampleGroup#shared_examples. |
shared_examples | Stores the block for later use. |
shared_examples_for | Alias for SharedExampleGroup#shared_examples. |
MemoizedHelpers::ClassMethods
- Extended
let | Generates a method whose return value is memoized after the first call. |
let! | Just like |
subject | Declares a |
subject! | Just like |
Hooks
- Extended
after | Declare a block of code to be run after each example (using |
append_after | Adds |
append_before | Alias for Hooks#before. |
around | Declare a block of code, parts of which will be run before and parts after the example. |
before | Declare a block of code to be run before each example (using |
hooks | Holds the various registered hooks. |
prepend_after | Alias for Hooks#after. |
prepend_before | Adds |
Instance Attribute Summary
MemoizedHelpers
- Included
#__memoized | should just be placed in private section, but Ruby issues warnings on private attributes. |
Instance Method Summary
Pending
- Included
MemoizedHelpers
- Included
#is_expected | Wraps the |
#should | When |
#should_not | Just like |
#subject, #__init_memoized, #enforce_value_expectation, #initialize, #matcher_supports_value_expectations? |
Class Attribute Details
.currently_executing_a_context_hook? ⇒ Boolean
(readonly)
Returns true if a ‘before(:context)` or after(:context)
hook is currently executing.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 542
def self.currently_executing_a_context_hook? @currently_executing_a_context_hook end
.top_level? ⇒ Boolean
(readonly)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 513
def self.top_level? superclass == ExampleGroup end
Class Method Details
.add_example(example)
Adds an example to the example group
# File 'rspec-core/lib/rspec/core/example_group.rb', line 367
def self.add_example(example) reset_memoized examples << example end
.before_context_ivars
# File 'rspec-core/lib/rspec/core/example_group.rb', line 529
def self.before_context_ivars @before_context_ivars ||= {} end
.children
# File 'rspec-core/lib/rspec/core/example_group.rb', line 466
def self.children @children ||= [] end
.declaration_locations
# File 'rspec-core/lib/rspec/core/example_group.rb', line 667
def self.declaration_locations @declaration_locations ||= [Metadata.location_tuple_from( )] + examples.map { |e| Metadata.location_tuple_from(e. ) } + FlatMap.flat_map(children, &:declaration_locations) end
.define_example_group_method(name, metadata = {})
# File 'rspec-core/lib/rspec/core/example_group.rb', line 246
def self.define_example_group_method(name, ={}) idempotently_define_singleton_method(name) do |*args, &example_group_block| thread_data = RSpec::Support.thread_local_data top_level = self == ExampleGroup registration_collection = if top_level if thread_data[:in_example_group] raise "Creating an isolated context from within a context is " \ "not allowed. Change `RSpec.#{name}` to `#{name}` or " \ "move this to a top-level scope." end thread_data[:in_example_group] = true RSpec.world.example_groups else children end begin description = args.shift = .dup .merge!(args.pop) if args.last.is_a? Hash args << subclass(self, description, args, registration_collection, &example_group_block) ensure thread_data.delete(:in_example_group) if top_level end end RSpec::Core::DSL.expose_example_group_alias(name) end
.define_example_method(name, extra_options = {})
@example
$1 "does something", :slow, :load_factor => 100 do
end
# File 'rspec-core/lib/rspec/core/example_group.rb', line 145
def self.define_example_method(name, ={}) idempotently_define_singleton_method(name) do |*all_args, &block| desc, *args = *all_args = Metadata.build_hash_from(args) .update(:skip => RSpec::Core::Pending::NOT_YET_IMPLEMENTED) unless block .update( ) RSpec::Core::Example.new(self, desc, , block) end end
.delegate_to_metadata(*names)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 76
def self. (*names) names.each do |name| idempotently_define_singleton_method(name) { .fetch(name) } end end
.descendant_filtered_examples
# File 'rspec-core/lib/rspec/core/example_group.rb', line 460
def self.descendant_filtered_examples @descendant_filtered_examples ||= filtered_examples + FlatMap.flat_map(children, &:descendant_filtered_examples) end
.descendants
.description ⇒ String
# File 'rspec-core/lib/rspec/core/example_group.rb', line 85
def self.description description = [:description] RSpec.configuration.format_docstrings_block.call(description) end
.each_instance_variable_for_example(group)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 700
def self.each_instance_variable_for_example(group) group.instance_variables.each do |ivar| yield ivar unless ivar == INSTANCE_VARIABLE_TO_IGNORE end end
.ensure_example_groups_are_configured
# File 'rspec-core/lib/rspec/core/example_group.rb', line 518
def self.ensure_example_groups_are_configured unless defined?(@@example_groups_configured) RSpec.configuration.configure_mock_framework RSpec.configuration.configure_expectation_framework # rubocop:disable Style/ClassVars @@example_groups_configured = true # rubocop:enable Style/ClassVars end end
.example
.example(&example_implementation)
.example(doc_string, *metadata)
.example(doc_string, *metadata, &example_implementation)
Defines an example within a group.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 158
define_example_method :example
.examples
# File 'rspec-core/lib/rspec/core/example_group.rb', line 450
def self.examples @examples ||= [] end
.fexample
.fexample(&example_implementation)
.fexample(doc_string, *metadata)
.fexample(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:focus => true`.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 177
define_example_method :fexample, :focus => true
.filtered_examples
.fit
.fit(&example_implementation)
.fit(doc_string, *metadata)
.fit(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:focus => true`.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 180
define_example_method :fit, :focus => true
.focus
.focus(&example_implementation)
.focus(doc_string, *metadata)
.focus(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:focus => true`.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 174
define_example_method :focus, :focus => true
.for_filtered_examples(reporter, &block)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 655
def self.for_filtered_examples(reporter, &block) filtered_examples.each(&block) children.each do |child| reporter.example_group_started(child) child.for_filtered_examples(reporter, &block) reporter.example_group_finished(child) end false end
.fspecify
.fspecify(&example_implementation)
.fspecify(doc_string, *metadata)
.fspecify(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:focus => true`.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 183
define_example_method :fspecify, :focus => true
.id ⇒ String
.idempotently_define_singleton_method(name, &definition)
Define a singleton method for the singleton class (remove the method if it’s already been defined).
# File 'rspec-core/lib/rspec/core/example_group.rb', line 40
def self.idempotently_define_singleton_method(name, &definition) (class << self; self; end).module_exec do remove_method(name) if method_defined?(name) && instance_method(name).owner == self define_method(name, &definition) end end
.include_context(name, *args, &block)
Includes shared content mapped to name
directly in the group in which it is declared, as opposed to it_behaves_like
, which creates a nested group. If given a block, that block is also eval’d in the current context.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 343
def self.include_context(name, *args, &block) find_and_eval_shared("context", name, caller.first, *args, &block) end
.include_examples(name, *args, &block)
Includes shared content mapped to name
directly in the group in which it is declared, as opposed to it_behaves_like
, which creates a nested group. If given a block, that block is also eval’d in the current context.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 353
def self.include_examples(name, *args, &block) find_and_eval_shared("examples", name, caller.first, *args, &block) end
.initialize(inspect_output = nil)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 707
def initialize(inspect_output=nil) @__inspect_output = inspect_output || '(no description provided)' super() # no args get passed end
.inspect
# File 'rspec-core/lib/rspec/core/example_group.rb', line 713
def inspect "#<#{self.class} #{@__inspect_output}>" end
.it
.it(&example_implementation)
.it(doc_string, *metadata)
.it(doc_string, *metadata, &example_implementation)
Defines an example within a group. This is the primary API to define a code example.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 161
define_example_method :it
.metadata
The [Metadata](Metadata) object associated with this group.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 51
def self. @metadata ||= nil end
.method_missing(name, *args) (private)
See additional method definition at line 742.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 758
def self.method_missing(name, *args) if method_defined?(name) raise WrongScopeError, "`#{name}` is not available on an example group (e.g. a " \ "`describe` or `context` block). It is only available from " \ "within individual examples (e.g. `it` blocks) or from " \ "constructs that run in the scope of an example (e.g. " \ "`before`, `let`, etc)." end super end
.next_runnable_index_for(file)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 485
def self.next_runnable_index_for(file) if self == ExampleGroup # We add 1 so the ids start at 1 instead of 0. This is # necessary for this branch (but not for the other one) # because we register examples and groups with the # `children` and `examples` collection BEFORE this # method is called as part of metadata hash creation, # but the example group is recorded with # `RSpec.world.example_group_counts_by_spec_file` AFTER # the metadata hash is created and the group is returned # to the caller. RSpec.world.num_example_groups_defined_in(file) + 1 else children.count + examples.count end end
.ordering_strategy
# File 'rspec-core/lib/rspec/core/example_group.rb', line 625
def self.ordering_strategy order = .fetch(:order, :global) registry = RSpec.configuration.ordering_registry registry.fetch(order) do warn <<-WARNING.gsub(/^ +\|/, '') |WARNING: Ignoring unknown ordering specified using `:order => #{order.inspect}` metadata. | Falling back to configured global ordering. | Unrecognized ordering specified at: #{location} WARNING registry.fetch(:global) end end
.parent_groups
.pending
.pending(&example_implementation)
.pending(doc_string, *metadata)
.pending(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:pending => true`
# File 'rspec-core/lib/rspec/core/example_group.rb', line 198
define_example_method :pending, :pending => true
.remove_example(example)
Removes an example from the example group
# File 'rspec-core/lib/rspec/core/example_group.rb', line 373
def self.remove_example(example) reset_memoized examples.delete example end
.reset_memoized
Clear memoized values when adding/removing examples
# File 'rspec-core/lib/rspec/core/example_group.rb', line 359
def self.reset_memoized @descendant_filtered_examples = nil @_descendants = nil @parent_groups = nil @declaration_locations = nil end
.run(reporter = RSpec::Core::NullReporter)
Runs all the examples in this group.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 599
def self.run(reporter=RSpec::Core::NullReporter) return if RSpec.world.wants_to_quit reporter.example_group_started(self) should_run_context_hooks = descendant_filtered_examples.any? begin RSpec.current_scope = :before_context_hook run_before_context_hooks(new('before(:context) hook')) if should_run_context_hooks result_for_this_group = run_examples(reporter) results_for_descendants = ordering_strategy.order(children).map { |child| child.run(reporter) }.all? result_for_this_group && results_for_descendants rescue Pending::SkipDeclaredInExample => ex for_filtered_examples(reporter) { |example| example.skip_with_exception(reporter, ex) } true rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex for_filtered_examples(reporter) { |example| example.fail_with_exception(reporter, ex) } RSpec.world.wants_to_quit = true if reporter.fail_fast_limit_met? false ensure RSpec.current_scope = :after_context_hook run_after_context_hooks(new('after(:context) hook')) if should_run_context_hooks reporter.example_group_finished(self) end end
.run_after_context_hooks(example_group_instance)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 585
def self.run_after_context_hooks(example_group_instance) set_ivars(example_group_instance, before_context_ivars) @currently_executing_a_context_hook = true ContextHookMemoized::After.isolate_for_context_hook(example_group_instance) do hooks.run(:after, :context, example_group_instance) end ensure before_context_ivars.clear @currently_executing_a_context_hook = false end
.run_before_context_hooks(example_group_instance)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 547
def self.run_before_context_hooks(example_group_instance) set_ivars(example_group_instance, superclass_before_context_ivars) @currently_executing_a_context_hook = true ContextHookMemoized::Before.isolate_for_context_hook(example_group_instance) do hooks.run(:before, :context, example_group_instance) end ensure store_before_context_ivars(example_group_instance) @currently_executing_a_context_hook = false end
.run_examples(reporter)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 641
def self.run_examples(reporter) ordering_strategy.order(filtered_examples).map do |example| next if RSpec.world.wants_to_quit instance = new(example.inspect_output) set_ivars(instance, before_context_ivars) succeeded = example.run(instance, reporter) if !succeeded && reporter.fail_fast_limit_met? RSpec.world.wants_to_quit = true end succeeded end.all? end
.set_it_up(description, args, registration_collection, &example_group_block)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 410
def self.set_it_up(description, args, registration_collection, &example_group_block) # Ruby 1.9 has a bug that can lead to infinite recursion and a # SystemStackError if you include a module in a superclass after # including it in a subclass: https://gist.github.com/845896 # To prevent this, we must include any modules in # RSpec::Core::ExampleGroup before users create example groups and have # a chance to include the same module in a subclass of # RSpec::Core::ExampleGroup. So we need to configure example groups # here. ensure_example_groups_are_configured # Register the example with the group before creating the metadata hash. # This is necessary since creating the metadata hash triggers # `when_first_matching_example_defined` callbacks, in which users can # load RSpec support code which defines hooks. For that to work, the # examples and example groups must be registered at the time the # support code is called or be defined afterwards. # Begin defined beforehand but registered afterwards causes hooks to # not be applied where they should. registration_collection << self @user_metadata = Metadata.build_hash_from(args) @metadata = Metadata::ExampleGroupHash.create( , @user_metadata, superclass.method(:next_runnable_index_for), description, *args, &example_group_block ) config = RSpec.configuration config. (@metadata) ExampleGroups.assign_const(self) @currently_executing_a_context_hook = false config.configure_group(self) end
.set_ivars(instance, ivars)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 685
def self.set_ivars(instance, ivars) ivars.each { |name, value| instance.instance_variable_set(name, value) } end
.singleton_class
:nocov:
# File 'rspec-core/lib/rspec/core/example_group.rb', line 720
def singleton_class class << self; self; end end
.skip
.skip(&example_implementation)
.skip(doc_string, *metadata)
.skip(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:skip => true`
# File 'rspec-core/lib/rspec/core/example_group.rb', line 195
define_example_method :skip, :skip => true
.specify
.specify(&example_implementation)
.specify(doc_string, *metadata)
.specify(doc_string, *metadata, &example_implementation)
Defines an example within a group. Useful for when your docstring does not read well off of .it.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 170
define_example_method :specify
.store_before_context_ivars(example_group_instance)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 534
def self.store_before_context_ivars(example_group_instance) each_instance_variable_for_example(example_group_instance) do |ivar| before_context_ivars[ivar] = example_group_instance.instance_variable_get(ivar) end end
.subclass(parent, description, args, registration_collection, &example_group_block)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 395
def self.subclass(parent, description, args, registration_collection, &example_group_block) subclass = Class.new(parent) subclass.set_it_up(description, args, registration_collection, &example_group_block) subclass.module_exec(&example_group_block) if example_group_block # The LetDefinitions module must be included _after_ other modules # to ensure that it takes precedence when there are name collisions. # Thus, we delay including it until after the example group block # has been eval'd. MemoizedHelpers.define_helpers_on(subclass) subclass end
.superclass_before_context_ivars
:nocov:
See additional method definition at line 562.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 568
def self.superclass_before_context_ivars superclass.before_context_ivars end
.superclass_metadata ⇒ Metadata
# File 'rspec-core/lib/rspec/core/example_group.rb', line 71
def self. @superclass_metadata ||= superclass.respond_to?(: ) ? superclass. : nil end
.top_level_description
# File 'rspec-core/lib/rspec/core/example_group.rb', line 680
def self.top_level_description parent_groups.last.description end
.traverse_tree_until(&block)
Traverses the tree of groups, starting with self
, then the children, recursively. Halts the traversal of a branch of the tree as soon as the passed block returns true. Note that siblings groups and their sub-trees will continue to be explored. This is intended to make it easy to find the top-most group that satisfies some condition.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 476
def self.traverse_tree_until(&block) return if yield self children.each do |child| child.traverse_tree_until(&block) end end
.update_inherited_metadata(updates)
# File 'rspec-core/lib/rspec/core/example_group.rb', line 727
def self. (updates) .update(updates) do |key, existing_group_value, new_inherited_value| @user_metadata.key?(key) ? existing_group_value : new_inherited_value end RSpec.configuration.configure_group(self) examples.each { |ex| ex. (updates) } children.each { |group| group. (updates) } end
.with_replaced_metadata(meta)
Temporarily replace the provided metadata. Intended primarily to allow an example group’s singleton class to return the metadata of the example that it exists for. This is necessary for shared example group inclusion to work properly with singleton example groups.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 61
def self. ( ) = @metadata = yield ensure @metadata = end
.xexample
.xexample(&example_implementation)
.xexample(doc_string, *metadata)
.xexample(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:skip => ’Temporarily skipped with xexample’‘.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 186
define_example_method :xexample, :skip => 'Temporarily skipped with xexample'
.xit
.xit(&example_implementation)
.xit(doc_string, *metadata)
.xit(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:skip => ’Temporarily skipped with xit’‘.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 189
define_example_method :xit, :skip => 'Temporarily skipped with xit'
.xspecify
.xspecify(&example_implementation)
.xspecify(doc_string, *metadata)
.xspecify(doc_string, *metadata, &example_implementation)
Shortcut to define an example with ‘:skip => ’Temporarily skipped with xspecify’‘.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 192
define_example_method :xspecify, :skip => 'Temporarily skipped with xspecify'
Instance Method Details
#described_class
Returns the class or module passed to the describe
method (or alias). Returns nil if the subject is not a class or module.
# File 'rspec-core/lib/rspec/core/example_group.rb', line 99
def described_class self.class.described_class end