Skip to content

Commit 15e0300

Browse files
lizkenyonclaude
andcommitted
Fix Rails 7.1 compatibility issues - Phase 2
- Update mocha from 2.0.2 to 2.8.0 for Rails 7.1 Minitest compatibility - Fix Rails 7.1 deprecation warnings in test environment: - Update static file server config to use public_file_server - Change show_exceptions from boolean to symbol (:none) - Set secret_key_base directly to avoid secrets.yml deprecation - Fix require_relative paths for rails_generator_runtime in test files Tests now run successfully with most passing. Ready for Phase 3. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a3355b9 commit 15e0300

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ GEM
144144
method_source (1.0.0)
145145
mini_mime (1.1.5)
146146
minitest (5.26.1)
147-
mocha (2.0.2)
147+
mocha (2.8.0)
148148
ruby2_keywords (>= 0.0.5)
149149
multi_xml (0.6.0)
150150
mutex_m (0.3.0)
@@ -321,7 +321,7 @@ DEPENDENCIES
321321
csv
322322
jwt (>= 2.2.3)
323323
minitest
324-
mocha
324+
mocha (>= 2.1.0)
325325
mutex_m
326326
pry
327327
pry-nav

shopify_app.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
2323
s.add_development_dependency("csv")
2424
s.add_development_dependency("jwt", ">= 2.2.3")
2525
s.add_development_dependency("minitest")
26-
s.add_development_dependency("mocha")
26+
s.add_development_dependency("mocha", ">= 2.1.0")
2727
s.add_development_dependency("mutex_m")
2828
s.add_development_dependency("pry")
2929
s.add_development_dependency("pry-nav")

test/dummy/config/environments/test.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
config.eager_load = false
1616

1717
# Configure static file server for tests with Cache-Control for performance.
18-
config.serve_static_files = true
19-
config.static_cache_control = "public, max-age=3600"
18+
config.public_file_server.enabled = true
19+
config.public_file_server.headers = {
20+
"Cache-Control" => "public, max-age=3600"
21+
}
2022

2123
# Show full error reports and disable caching.
2224
config.consider_all_requests_local = true
2325
config.action_controller.perform_caching = false
2426

2527
# Raise exceptions instead of rendering exception templates.
26-
config.action_dispatch.show_exceptions = false
28+
config.action_dispatch.show_exceptions = :none
2729

2830
# Disable request forgery protection in test environment.
2931
config.action_controller.allow_forgery_protection = false
@@ -41,4 +43,8 @@
4143

4244
# Raises error for missing translations
4345
# config.action_view.raise_on_missing_translations = true
46+
47+
# Set secret_key_base directly to avoid deprecation warning
48+
# This is acceptable for a test dummy app in a gem
49+
config.secret_key_base = "test-secret-key-base-for-dummy-app-testing-only"
4450
end

test/generators/home_controller_generator_with_execution_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

3-
require "test_helper"
4-
require "utils/rails_generator_runtime"
5-
require "generators/shopify_app/home_controller/home_controller_generator"
6-
require "generators/shopify_app/authenticated_controller/authenticated_controller_generator"
7-
require "dummy/app/controllers/application_controller"
3+
require_relative "../test_helper"
4+
require_relative "../utils/rails_generator_runtime"
5+
require_relative "../../lib/generators/shopify_app/home_controller/home_controller_generator"
6+
require_relative "../../lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator"
7+
require_relative "../dummy/app/controllers/application_controller"
88

99
class HomeControllerGeneratorWithExecutionTest < ActiveSupport::TestCase
1010
test "generates authenticated HomeController class if not embedded" do

test/generators/products_controller_generator_with_execution_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

3-
require "test_helper"
4-
require "utils/rails_generator_runtime"
5-
require "generators/shopify_app/products_controller/products_controller_generator"
6-
require "generators/shopify_app/authenticated_controller/authenticated_controller_generator"
7-
require "dummy/app/controllers/application_controller"
3+
require_relative "../test_helper"
4+
require_relative "../utils/rails_generator_runtime"
5+
require_relative "../../lib/generators/shopify_app/products_controller/products_controller_generator"
6+
require_relative "../../lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator"
7+
require_relative "../dummy/app/controllers/application_controller"
88

99
class ProductsControllerGeneratorWithExecutionTest < ActiveSupport::TestCase
1010
test "generates valid ProductController class" do

0 commit comments

Comments
 (0)