Skip to content

Commit

Permalink
Run tests with warnings enabled (#1462)
Browse files Browse the repository at this point in the history
* Remove format constraint from `frontend/static` route

`format` doesn't accept an array. This currently creates a format constraint that looks like this,
and emits a warning because characters appear multiple times in the character class:
`/\A["css", "js", "svg"]\Z/`

The constraint is actually not needed, the controller already handles this.

* Resolve some test-only warnings

* Run tests with warnings enabled
  • Loading branch information
Earlopain authored Aug 9, 2024
1 parent 72ba713 commit a61fc09
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@

scope :frontend, controller: :frontends, defaults: { version: GoodJob::VERSION.tr(".", "-") } do
get "modules/:version/:id", action: :module, as: :frontend_module, constraints: { format: 'js' }
get "static/:version/:id", action: :static, as: :frontend_static, constraints: { format: %w[css js svg] }
get "static/:version/:id", action: :static, as: :frontend_static
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
mocks.verify_partial_doubles = true
end

config.warnings = true

# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
# have no way to turn it off -- the option exists only for backwards
# compatibility in RSpec 3). It causes shared context metadata to be
Expand Down
2 changes: 2 additions & 0 deletions spec/support/reset_rails_queue_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ module ActiveJob
module TestHelper
# Avoid calling #descendants because JRuby has trouble with it
# https://github.com/jruby/jruby/issues/6896
silence_redefinition_of_method :queue_adapter_changed_jobs
def queue_adapter_changed_jobs
[]
end

module TestQueueAdapter
module ClassMethods
silence_redefinition_of_method :queue_adapter
def queue_adapter # rubocop:disable Lint/UselessMethodDefinition
super
end
Expand Down
1 change: 1 addition & 0 deletions spec/support/selenium.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
module ActionDispatch
module SystemTesting
class Browser # :nodoc:
silence_redefinition_of_method :resolve_driver_path
def resolve_driver_path(namespace)
# The path method has been deprecated in 4.20.0
namespace::Service.driver_path = if Gem::Version.new(::Selenium::WebDriver::VERSION) >= Gem::Version.new("4.20.0")
Expand Down

0 comments on commit a61fc09

Please sign in to comment.