Skip to content

Commit b4870a8

Browse files
committed
test: Enable backward-compatible options for tests
1 parent e399786 commit b4870a8

3 files changed

Lines changed: 21 additions & 13 deletions

File tree

spec/dummy/config/environments/development.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@
44

55
Rails.application.configure do
66
config.after_initialize do
7-
Bullet.enable = true
8-
Bullet.alert = true
7+
Bullet.enable = true
8+
Bullet.alert = true
99
Bullet.bullet_logger = true
10-
Bullet.console = true
11-
Bullet.rails_logger = true
12-
Bullet.add_footer = true
10+
Bullet.console = true
11+
Bullet.rails_logger = true
12+
Bullet.add_footer = true
1313
end
1414

1515
# Settings specified here will take precedence over those in config/application.rb.
1616

1717
# In the development environment your application's code is reloaded any time
1818
# it changes. This slows down response time but is perfect for development
1919
# since you don't have to restart the web server when you make code changes.
20-
config.cache_classes = false
20+
if config.respond_to?(:enable_reloading)
21+
config.enable_reloading = true
22+
else
23+
config.cache_classes = false
24+
end
2125

2226
# Do not eager load code on boot.
2327
config.eager_load = false
@@ -82,5 +86,5 @@
8286

8387
###
8488

85-
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
89+
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
8690
end

spec/dummy/config/environments/test.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@
99

1010
Rails.application.configure do
1111
config.after_initialize do
12-
Bullet.enable = true
12+
Bullet.enable = true
1313
Bullet.bullet_logger = true
14-
Bullet.raise = true # raise an error if n+1 query occurs
14+
Bullet.raise = true # raise an error if n+1 query occurs
1515
end
1616

1717
# Settings specified here will take precedence over those in config/application.rb.
1818

1919
# Turn false under Spring and add config.action_view.cache_template_loading = true.
20-
config.cache_classes = true
20+
if config.respond_to?(:enable_reloading)
21+
config.enable_reloading = false
22+
else
23+
config.cache_classes = true
24+
end
2125

2226
# Eager loading loads your whole application. When running a single test locally,
2327
# this probably isn't necessary. It's a good idea to do in a continuous integration
@@ -31,12 +35,12 @@
3135
}
3236

3337
# Show full error reports and disable caching.
34-
config.consider_all_requests_local = true
38+
config.consider_all_requests_local = true
3539
config.action_controller.perform_caching = false
3640
config.cache_store = :null_store
3741

3842
# Raise exceptions instead of rendering exception templates.
39-
config.action_dispatch.show_exceptions = false
43+
config.action_dispatch.show_exceptions = Rails::VERSION::MAJOR >= 7 ? :none : false
4044

4145
# Disable request forgery protection in test environment.
4246
config.action_controller.allow_forgery_protection = false

spec/dummy/db/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20_220_202_010_101) do
13+
ActiveRecord::Schema[7.1].define(version: 20_220_202_010_101) do
1414
create_table "active_storage_attachments", force: :cascade do |t|
1515
t.string "name", null: false
1616
t.string "record_type", null: false

0 commit comments

Comments
 (0)