From 9631355b8ef2c342fcad0f9f025d5f56b913cf75 Mon Sep 17 00:00:00 2001 From: Javier Julio Date: Mon, 8 Apr 2024 13:22:44 -0400 Subject: [PATCH] Fix uninitialized constant RSpec::Rails::OpenStruct error This started to occur on recent test suite runs. It may be related to a json gem update that removed the ostruct dependency as I encountered this with turbo_tests and a fix for that is in https://github.com/serpapi/turbo_tests/pull/49 with more details. --- spec/rspec/rails/example/view_example_group_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/rspec/rails/example/view_example_group_spec.rb b/spec/rspec/rails/example/view_example_group_spec.rb index 7f6629c7c..8759103b7 100644 --- a/spec/rspec/rails/example/view_example_group_spec.rb +++ b/spec/rspec/rails/example/view_example_group_spec.rb @@ -1,3 +1,4 @@ +require 'ostruct' require 'support/group_failure_formatter' module RSpec::Rails @@ -187,7 +188,7 @@ def _default_file_to_render; end # Stub method Class.new do include ViewExampleGroup::ExampleMethods def controller - @controller ||= OpenStruct.new(params: nil) + @controller ||= ::OpenStruct.new(params: nil) end end.new end