Skip to content

Instantly share code, notes, and snippets.

@nishio-dens
Created October 23, 2021 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nishio-dens/c64245eb143e9c3b22b9d7b9f93f25d2 to your computer and use it in GitHub Desktop.
Save nishio-dens/c64245eb143e9c3b22b9d7b9f93f25d2 to your computer and use it in GitHub Desktop.
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "capybara"
gem "rspec"
gem "webdrivers"
gem "debug"
end
require "debug"
require "capybara/rspec"
require "capybara/dsl"
Capybara.configure do |config|
config.run_server = false
config.default_driver = :selenium_chrome
config.javascript_driver = :selenium_chrome
config.app_host = "https://example.com"
end
require "rspec/expectations"
require "rspec/autorun"
RSpec.configure do |config|
config.include Capybara::DSL
config.before(:each) do |example|
if example.metadata[:session] == :another_session
Capybara.session_name = :another_session
else
Capybara.session_name = :session
end
end
end
RSpec.describe "Debug Test" do
it "access 1" do
visit "/"
end
it "access 2", session: :another_session do
# does not end Chrome normally
visit "/"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment