Module: RSpec::Formatters

Includes:
Core::Formatters
Included in:
IllustratedDocumentationFormatter, IllustratedHtmlFormatter, IllustratedJsonFormatter, YARD
Defined in:
lib/rspec/formatters/yard.rb,
lib/rspec/formatters/illustration_formatter.rb,
lib/rspec/formatters/illustrated_json_formatter.rb,
lib/rspec/formatters/illustrated_html_formatter.rb,
lib/rspec/formatters/illustrated_documentation_formatter.rb

Defined Under Namespace

Classes: IllustratedDocumentationFormatter, IllustratedHtmlFormatter, IllustratedJsonFormatter, YARD

Class Method Summary (collapse)

Class Method Details

+ (Array<Hash>) filter(illustrations, filter_key)

Returns The illustrations that have truthy property values for filter_key.

Parameters:

  • filter_key (Symbol)

    The property that each illustration must have.

  • illustrations (Array<Hash>)

    A list of illustrations ({ Hash })

Returns:

  • (Array<Hash>)

    The illustrations that have truthy property values for filter_key.



21
22
23
# File 'lib/rspec/formatters/illustration_formatter.rb', line 21

def filter(illustrations, filter_key)
  illustrations.select{|illustration| illustration[filter_key]}
end

+ (Array<Hash>) illustrations_of(notification)

Returns The list of illustrations in the example, where each illustration is represented by a { Hash } containing its properties.

Parameters:

  • notification (RSpec::Core::Notifications::ExampleNotification)

    The example notification to be formatted.

Returns:

  • (Array<Hash>)

    The list of illustrations in the example, where each illustration is represented by a { Hash } containing its properties.



10
11
12
# File 'lib/rspec/formatters/illustration_formatter.rb', line 10

def illustrations_of(notification)
  notification.example.[:illustrations] || []
end