module RSpec::Rails::SystemExampleGroup

@api public Container class for system tests

Constants

CHARS_TO_TRANSLATE

Special characters to translate into underscores for method_name

Public Class Methods

new(*args, &blk) click to toggle source
Calls superclass method
# File lib/rspec/rails/example/system_example_group.rb, line 78
def initialize(*args, &blk)
  super(*args, &blk)
  @driver = nil
end

Public Instance Methods

app() click to toggle source

Delegates to `Rails.application`.

# File lib/rspec/rails/example/system_example_group.rb, line 44
def app
  ::Rails.application
end
driven_by(*args, &blk) click to toggle source
# File lib/rspec/rails/example/system_example_group.rb, line 83
def driven_by(*args, &blk)
  @driver = ::ActionDispatch::SystemTestCase.driven_by(*args, &blk).tap(&:use)
end
method_name() click to toggle source

@private

# File lib/rspec/rails/example/system_example_group.rb, line 36
def method_name
  @method_name ||= [
    self.class.name.underscore,
    RSpec.current_example.description.underscore
  ].join("_").tr(CHARS_TO_TRANSLATE.join, "_")[0...251] + "_#{rand(1000)}"
end
passed?() click to toggle source

for the SystemTesting Screenshot situation

# File lib/rspec/rails/example/system_example_group.rb, line 25
def passed?
  return false if RSpec.current_example.exception
  return true unless defined?(::RSpec::Expectations::FailureAggregator)

  failure_notifier = ::RSpec::Support.failure_notifier
  return true unless failure_notifier.is_a?(::RSpec::Expectations::FailureAggregator)

  failure_notifier.failures.empty? && failure_notifier.other_errors.empty?
end