Skip to content

Commit 5cad689

Browse files
committed
Fix test
I also made it check the default buffer size from the OS, as the value used wasn't enough to fill the buffer on my computer, so the test would pass with or without the fix.
1 parent 874ccc5 commit 5cad689

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

lib/spring/test/acceptance_test.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ def self.omg
124124
assert_failure app.spring_test_command, stdout: "RuntimeError: omg"
125125
end
126126

127+
test "app gets reloaded even with a ton of boot output" do
128+
limit = UNIXSocket.pair.first.getsockopt(:SOCKET, :SNDBUF).int
129+
130+
assert_success app.spring_test_command
131+
File.write(app.path("config/initializers/verbose.rb"), "#{limit}.times { puts 'x' }")
132+
133+
app.await_reload
134+
assert_success app.spring_test_command
135+
end
136+
127137
test "app recovers when a boot-level error is introduced" do
128138
config = app.application_config.read
129139

@@ -328,17 +338,6 @@ def exec_name
328338
expr = "p Kernel.private_instance_methods.include?(:raise)"
329339
assert_success %(bin/rails runner '#{expr}'), stdout: "true"
330340
end
331-
332-
test "app gets reloaded even with a ton of boot output" do
333-
File.write(app.path("config/initializers/verbose.rb"), "50.times { puts 'x' * 80 }\n")
334-
begin
335-
app.env["RAILS_ENV"] = "test"
336-
assert_success "bin/rails runner 'puts Spring.watcher.class'", stdout: "Polling"
337-
assert_app_reloaded
338-
ensure
339-
File.unlink(app.path("config/initializers/verbose.rb"))
340-
end
341-
end
342341
end
343342
end
344343
end

0 commit comments

Comments
 (0)