Sha256: 6bec5d8e00df92413742f9a7a699b827563e235f288b6885e2a3beef1376f836

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

require_relative 'all_inc.rb'

require 'rspec/rails'
require 'capybara/rails'

require_relative 'support/config'

puts "loading fail_fast.rb"

RSpec.configure do |config|
  config.fail_fast = true

  config.after(:each) do
    if example.exception
      # stub in browser close method
      Selenium::WebDriver::Driver.class_eval do
        def quit
          puts "preventing browser close"
          #STDOUT.puts "#{self.class}#quit: no-op"
        end
      end

      # stub in driver close method
      Selenium::WebDriver::Chrome::Service.class_eval do
        def stop
          puts "preventing ChromeDriver stop"
          #STDOUT.puts "#{self.class}#stop: no-op"
        end
      end
      
      # stub in Capybara's reset which to resets browser to about page
      Capybara::Selenium::Driver.class_eval do
        def reset!
          puts "preventing reset to about page"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sim-0.0.2 lib/sim/fail_fast.rb
sim-0.0.1 lib/sim/fail_fast.rb