forked from fixin.me/fixin.me
Test infrastructure: - Allow www.example.com host in test env (ActionDispatch::HostAuthorization was blocking all integration test requests) - Include Devise::Test::IntegrationHelpers in ActionDispatch::IntegrationTest so tests can sign in with sign_in(user) Controller tests: - Rewrite UsersControllerTest to match actual routes/actions (no new/create/ edit/destroy); sign in as admin; test update-self rejection via turbo_stream - Fix Default::UnitsControllerTest to sign in before requesting the index SQLite compatibility in Unit#defaults_diff: - Hoist the inner "units" CTE to the outer WITH RECURSIVE level (fixes nested WITH syntax error) — this was the existing TODO in the code - Use Unit.joins(...) for the recursive part instead of a raw Arel::SelectManager so the SQLite visitor does not wrap it in parentheses inside UNION ALL - Drop the named "units" CTE (conflicts with the table name under WITH RECURSIVE in SQLite); apply the user/defaults scope directly on the base case - Qualify GROUP BY columns to avoid ambiguity when bases_units is joined - Qualify ORDER BY :multiplier/:symbol to avoid ambiguity (Unit.ordering) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
2.4 KiB
Ruby
65 lines
2.4 KiB
Ruby
require "active_support/core_ext/integer/time"
|
|
|
|
# The test environment is used exclusively to run your application's
|
|
# test suite. You never need to work with it otherwise. Remember that
|
|
# your test database is "scratch space" for the test suite and is wiped
|
|
# and recreated between test runs. Don't rely on the data there!
|
|
|
|
Rails.application.configure do
|
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
|
|
# Turn false under Spring and add config.action_view.cache_template_loading = true.
|
|
config.cache_classes = true
|
|
|
|
# Eager loading loads your whole application. When running a single test locally,
|
|
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
|
# system, or in some way before deploying your code.
|
|
config.eager_load = ENV["CI"].present?
|
|
|
|
# Configure public file server for tests with Cache-Control for performance.
|
|
config.public_file_server.enabled = true
|
|
config.public_file_server.headers = {
|
|
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
|
}
|
|
|
|
# Hide full error reports.
|
|
config.consider_all_requests_local = false
|
|
# Render exception templates instead of raising exceptions.
|
|
config.action_dispatch.show_exceptions = :all
|
|
|
|
# Disable caching.
|
|
config.action_controller.perform_caching = false
|
|
config.cache_store = :null_store
|
|
|
|
# Disable request forgery protection in test environment.
|
|
config.action_controller.allow_forgery_protection = false
|
|
|
|
config.action_mailer.perform_caching = false
|
|
|
|
# Tell Action Mailer not to deliver emails to the real world.
|
|
# The :test delivery method accumulates sent emails in the
|
|
# ActionMailer::Base.deliveries array.
|
|
config.action_mailer.delivery_method = :test
|
|
config.action_mailer.default_url_options = {host: '127.0.0.1', :protocol => 'http'}
|
|
|
|
# Print deprecation notices to the stderr.
|
|
config.active_support.deprecation = :stderr
|
|
|
|
# Raise exceptions for disallowed deprecations.
|
|
config.active_support.disallowed_deprecation = :raise
|
|
|
|
# Tell Active Support which deprecation messages to disallow.
|
|
config.active_support.disallowed_deprecation_warnings = []
|
|
|
|
# Raises error for missing translations.
|
|
config.i18n.raise_on_missing_translations = true
|
|
|
|
# Annotate rendered view with file names.
|
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
|
|
config.log_level = :info
|
|
|
|
# Allow the default integration test host.
|
|
config.hosts << "www.example.com"
|
|
end
|