module RSpec::Rails::SystemExampleGroup
@api public Container class for system tests
Constants
- CHARS_TO_TRANSLATE
Special characters to translate into underscores for
method_name
Attributes
driver[R]
Public Class Methods
new(*args, &blk)
click to toggle source
Calls superclass method
# File lib/rspec/rails/example/system_example_group.rb, line 133 def initialize(*args, &blk) super(*args, &blk) @driver = nil self.class.before do # A user may have already set the driver, so only default if driver # is not set driven_by(:selenium) unless @driver end end
Public Instance Methods
app()
click to toggle source
Delegates to ‘Rails.application`.
# File lib/rspec/rails/example/system_example_group.rb, line 94 def app ::Rails.application end
driven_by(driver, **driver_options, &blk)
click to toggle source
# File lib/rspec/rails/example/system_example_group.rb, line 144 def driven_by(driver, **driver_options, &blk) @driver = ::ActionDispatch::SystemTestCase.driven_by(driver, **driver_options, &blk).tap(&:use) end
metadata()
click to toggle source
@private
# File lib/rspec/rails/example/system_example_group.rb, line 88 def metadata @metadata ||= SuppressRailsScreenshotMetadata.new end
method_name()
click to toggle source
@private
# File lib/rspec/rails/example/system_example_group.rb, line 40 def method_name @method_name ||= [ self.class.name.underscore, RSpec.current_example.description.underscore ].join("_").tr(CHARS_TO_TRANSLATE.join, "_").byteslice(0...200).scrub("") + "_#{rand(1000)}" end
passed?()
click to toggle source
for the SystemTesting Screenshot situation
# File lib/rspec/rails/example/system_example_group.rb, line 29 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