Skip to content

Commit

Permalink
use firefox / silence deprecations / rubo github output
Browse files Browse the repository at this point in the history
  • Loading branch information
rococodogs committed Aug 26, 2024
1 parent c763dee commit 09d9581
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,14 @@ jobs:
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update -y && apt-get install -y --no-install-recommends \
build-essential coreutils curl firefox-esr git libpq-dev libxml2 libxml2-dev libxslt-dev \
build-essential coreutils curl git libpq-dev libxml2 libxml2-dev libxslt-dev \
netcat-openbsd nodejs openssl postgresql-13 ruby-dev tzdata unzip zip
-
name: Setup Chrome
uses: browser-actions/setup-chrome@v1
id: setup-chrome
name: Setup Firefox
uses: browser-actions/setup-firefox@v1
id: setup-firefox
with:
chrome-version: stable
install-dependencies: true
install-chromedriver: true
firefox-version: stable
-
name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -144,7 +142,8 @@ jobs:
-
name: Run tests
env:
WD_CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
FIREFOX_BINARY_PATH: ${{ steps.setup-firefox.outputs.firefox-path }}
RAILS_SILENCE_DEPRECATIONS: true
run: |
mkdir /tmp/test-results
bundle exec rspec --backtrace --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,5 @@ group :development, :test do
gem 'stub_env', '~> 1.0.4'
gem 'webmock', '~> 3.8'
end

gem "rspec-github", "~> 2.4"
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-github (2.4.0)
rspec-core (~> 3.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
Expand Down Expand Up @@ -1131,6 +1133,7 @@ DEPENDENCIES
redlock (>= 0.1.2, < 2.0)
rsolr (~> 2.5.0)
rspec (~> 3.10)
rspec-github (~> 2.4)
rspec-its (~> 1.1)
rspec-rails (~> 5.1)
rspec_junit_formatter (~> 0.4.1)
Expand Down
4 changes: 3 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
config.action_mailer.perform_caching = false

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
config.active_support.deprecation = begin
ActiveModel::Type::Boolean.new.cast(ENV.fetch('RAILS_SILENCE_DEPRECATIONS', false)) ? :silence : :log
end

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
Expand Down
7 changes: 4 additions & 3 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Silence deprecations via ENV
config.active_support.deprecation = begin
ActiveModel::Type::Boolean.new.cast(ENV.fetch('RAILS_SILENCE_DEPRECATIONS', false)) ? :silence : :stderr
end

config.active_job.queue_adapter = :test
config.exceptions_app = ->(env) { ErrorController.action(:show).call(env) }
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

Capybara.register_driver :selenium_firefox_headless do |app|
browser_options = ::Selenium::WebDriver::Firefox::Options.new
browser_options.binary = ENV['FIREFOX_BINARY_PATH'] if ENV['FIREFOX_BINARY_PATH'].present?
browser_options.args << '--headless'
Capybara::Selenium::Driver.new(app, browser: :firefox, options: browser_options)
end
Expand Down

0 comments on commit 09d9581

Please sign in to comment.