Method: RSpec::Core::Example#description

Defined in:
lib/rspec/core/example.rb

#descriptionvoid

Returns the string submitted to example or its aliases (e.g. specify, it, etc). If no string is submitted (e.g. it { is_expected.to do_something }) it returns the message generated by the matcher if there is one, otherwise returns a message including the location of the example.

[View source]

76
77
78
79
80
81
82
83
84
# File 'lib/rspec/core/example.rb', line 76

def description
  description = if [:description].to_s.empty?
                  location_description
                else
                  [:description]
                end

  RSpec.configuration.format_docstrings_block.call(description)
end