class RSpec::Rails::SystemExampleGroup::SuppressRailsScreenshotMetadata

@private Allows failure screenshot to work whilst not exposing metadata

Public Class Methods

new() click to toggle source
# File lib/rspec/rails/example/system_example_group.rb, line 51
def initialize
  @example_data = {}
end

Public Instance Methods

[](key) click to toggle source
# File lib/rspec/rails/example/system_example_group.rb, line 55
def [](key)
  if @example_data.key?(key)
    @example_data[key]
  else
    raise_wrong_scope_error
  end
end
[]=(key, value) click to toggle source
# File lib/rspec/rails/example/system_example_group.rb, line 63
def []=(key, value)
  if key == :failure_screenshot_path
    @example_data[key] = value
  else
    raise_wrong_scope_error
  end
end
method_missing(_name, *_args, &_block) click to toggle source
# File lib/rspec/rails/example/system_example_group.rb, line 71
def method_missing(_name, *_args, &_block)
  raise_wrong_scope_error
end

Private Instance Methods

raise_wrong_scope_error() click to toggle source
# File lib/rspec/rails/example/system_example_group.rb, line 77
def raise_wrong_scope_error
  raise RSpec::Core::ExampleGroup::WrongScopeError,
        "`metadata` is not available from within an example " \
        "(e.g. an `it` block) or from constructs that run in the " \
        "scope of an example (e.g. `before`, `let`, etc). It is " \
        "only available on an example group (e.g. a `describe` or "\
        "`context` block)"
end