Library providing tools for writing and running RSpec tests.
Namespace for deferred example functionality.
.reflect(example, source_locations: false) => String
Returns the full path of an example, including deferred example groups.
By default, returns the path in a single-line format similar to an example group description. Deferred example groups are parenthesized. When the :source_locations flag is set to true, it instead returns each example group or deferred group on its own line, along with the source location for that group.
Displaying the full path of failing specs:
config.after(:example) do |example|
next unless ENV['REFLECT_ON_FAILURE']
next unless example.metadata[:last_run_status] == 'failed'
STDERR.puts "\nFailing spec at:"
path =
RSpec::SleepingKingStudios::Deferred
.reflect(example, source_locations: true)
path =
SleepingKingStudios::Tools::Toolbelt
.instance
.string_tools
.indent(path)
STDERR.puts path
end
Back to Documentation | Versions | 2.8.1 | Reference | RSpec | RSpec::SleepingKingStudios