Sha256: ee5d6a3698fcb8e5e6725e1b21baedc7d4f445072635a5b7220f19b1d03eaafc

Contents?: true

Size: 1.13 KB

Versions: 20

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true
require 'capybara/dsl'
require 'rspec/core'
require 'capybara/rspec/matchers'
require 'capybara/rspec/features'

RSpec.configure do |config|
  config.include Capybara::DSL, :type => :feature
  config.include Capybara::RSpecMatchers, :type => :feature
  config.include Capybara::RSpecMatchers, :type => :view

  # A work-around to support accessing the current example that works in both
  # RSpec 2 and RSpec 3.
  fetch_current_example = RSpec.respond_to?(:current_example) ?
    proc { RSpec.current_example } : proc { |context| context.example }

  # The before and after blocks must run instantaneously, because Capybara
  # might not actually be used in all examples where it's included.
  config.after do
    if self.class.include?(Capybara::DSL)
      Capybara.reset_sessions!
      Capybara.use_default_driver
    end
  end
  config.before do
    if self.class.include?(Capybara::DSL)
      example = fetch_current_example.call(self)
      Capybara.current_driver = Capybara.javascript_driver if example.metadata[:js]
      Capybara.current_driver = example.metadata[:driver] if example.metadata[:driver]
    end
  end
end

Version data entries

20 entries across 19 versions & 3 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/capybara-2.13.0/lib/capybara/rspec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/capybara-2.13.0/lib/capybara/rspec.rb
tdiary-5.0.4 vendor/bundle/gems/capybara-2.13.0/lib/capybara/rspec.rb
capybara-2.13.0 lib/capybara/rspec.rb
capybara-2.12.1 lib/capybara/rspec.rb
capybara-2.12.0 lib/capybara/rspec.rb
capybara-2.11.0 lib/capybara/rspec.rb
capybara-2.10.2 lib/capybara/rspec.rb
capybara-2.10.1 lib/capybara/rspec.rb
capybara-2.10.0 lib/capybara/rspec.rb
capybara-2.9.2 lib/capybara/rspec.rb
tdiary-5.0.2 vendor/bundle/gems/capybara-2.8.0/lib/capybara/rspec.rb
capybara-2.9.1 lib/capybara/rspec.rb
capybara-2.9.0 lib/capybara/rspec.rb
capybara-2.8.1 lib/capybara/rspec.rb
capybara-2.8.0 lib/capybara/rspec.rb
tdiary-5.0.1 vendor/bundle/gems/capybara-2.7.1/lib/capybara/rspec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/capybara-2.7.1/lib/capybara/rspec.rb
capybara-2.7.1 lib/capybara/rspec.rb
capybara-2.7.0 lib/capybara/rspec.rb