Skip to content

Commit d18702b

Browse files
committed
Make turbo_test.rb with Rails' generated test_helper.rb
> Something in the test suite configuration is preventing the database > from being wiped between test runs. This results in state leaking > between tests. As a result, our Continuous Integration tests are flaky. > > - [hotwired#248][] As a follow-up to the [short-term solution][] shipped in [hotwired#248][], this commit attempts to make the `test/turbo_test.rb` file's setup consistent with the test harness setup generated by Rails' [engine generator][] code. To that end, this commit: * renames the `test/turbo_test.rb` file to `test/test_helper.rb` * omits one-off `require` calls for particular dependencies * re-orders the require calls so that the `../test/dummy/config/environment` file is required ahead of the `rails/test_help` file [engine generator]: https://github.com/rails/rails/blob/3c48b4030adbded21bebaa0d78254216cca48a6e/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt [hotwired#248]: hotwired#248 [short-term solution]: hotwired@c2dc5b1
1 parent 5040246 commit d18702b

12 files changed

+13
-20
lines changed

test/application_system_test_case.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
44
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]

test/drive/drive_helper_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class Turbo::DriveHelperTest < ActionDispatch::IntegrationTest
44
test "opting out of the default cache" do

test/frames/frame_request_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class Turbo::FrameRequestControllerTest < ActionDispatch::IntegrationTest
44
test "frame requests are rendered without a layout" do

test/frames/frames_helper_test.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class Turbo::FramesHelperTest < ActionView::TestCase
4-
setup { Message.delete_all }
5-
64
test "frame with src" do
75
assert_dom_equal %(<turbo-frame src="/trays/1" id="tray"></turbo-frame>), turbo_frame_tag("tray", src: "/trays/1")
86
end

test/initializers/helpers_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class Turbo::HelpersInInitializersTest < ActionDispatch::IntegrationTest
44
test "AC::Base has the helpers in place when initializers run" do

test/native/navigation_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class Turbo::Native::NavigationControllerTest < ActionDispatch::IntegrationTest
44
test "recede, resume, or refresh when native or redirect when not" do

test/streams/broadcastable_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22
require "action_cable"
33

44
class Turbo::BroadcastableTest < ActionCable::Channel::TestCase

test/streams/streams_channel_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22
require "action_cable"
33

44
class Turbo::StreamsChannelTest < ActionCable::Channel::TestCase

test/streams/streams_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class Turbo::StreamsControllerTest < ActionDispatch::IntegrationTest
44
test "create with respond to" do

test/streams/streams_helper_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "turbo_test"
1+
require "test_helper"
22

33
class TestChannel < ApplicationCable::Channel; end
44

0 commit comments

Comments
 (0)