123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Rails::SystemExampleGroup::SuppressRailsScreenshotMetadata Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: rspec-rails/lib/rspec/rails/example/system_example_group.rb

Overview

Allows failure screenshot to work whilst not exposing metadata

Class Method Summary

Instance Method Summary

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(_name, *_args, &_block)

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/example/system_example_group.rb', line 71

def method_missing(_name, *_args, &_block)
  raise_wrong_scope_error
end

Instance Method Details

#[](key)

[ GitHub ]

  
# File 'rspec-rails/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)

[ GitHub ]

  
# File 'rspec-rails/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

#raise_wrong_scope_error (private)

[ GitHub ]

  
# File 'rspec-rails/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