Files
nairobi/spec/rails_helper.rb
Javi Martín 45693e084b Integrate coveralls with github actions
Somehow I thought it worked automatically, but we had to provide the
token.

The configuration is based on Coveralls instructions to run parallel
builds [1].

Alternatively we could use the Coveralls GitHub Action [2] which
slightly simplifies the workflow configuration and removes the
dependency of the coveralls gem. However, it also adds a dependency on
simplecov-lcov and requires configuring it to renerate LCOV files on
each run, so the benefits of using it are not that big.

[1] https://docs.coveralls.io/parallel-build-webhook
[2] https://github.com/coverallsapp/github-action/
2021-04-02 20:33:23 +02:00

53 lines
1.3 KiB
Ruby

ENV["RAILS_ENV"] ||= "test"
if ENV["COVERALLS_REPO_TOKEN"]
require "coveralls"
Coveralls.wear!("rails")
end
require File.expand_path("../../config/environment", __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require "rspec/rails"
require "spec_helper"
require "capybara/rails"
require "capybara/rspec"
require "selenium/webdriver"
require "view_component/test_helpers"
RSpec.configure do |config|
config.include ViewComponent::TestHelpers, type: :component
end
Rails.application.load_tasks if Rake::Task.tasks.empty?
include Warden::Test::Helpers
Warden.test_mode!
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.infer_spec_type_from_file_location!
config.after do
Warden.test_reset!
end
end
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
"goog:chromeOptions" => {
args: %W[headless no-sandbox window-size=1200,600 proxy-server=127.0.0.1:#{Capybara::Webmock.port_number}]
}
)
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: capabilities
)
end
Capybara.exact = true
Capybara.enable_aria_label = true
Capybara.disable_animation = true
OmniAuth.config.test_mode = true