Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #flush and #sync methods to Puma::NullIO #2553

Merged
merged 1 commit into from Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions History.md
@@ -1,3 +1,8 @@
## 5.2.2 / 2021-02-

* Bugfixes
* Add `#flush` and `#sync` methods to `Puma::NullIO` ([#2553])

## 5.2.1 / 2021-02-05

* Bugfixes
Expand Down
8 changes: 8 additions & 0 deletions lib/puma/null_io.rb
Expand Up @@ -36,6 +36,10 @@ def eof?
true
end

def sync
true
end

def sync=(v)
end

Expand All @@ -44,5 +48,9 @@ def puts(*ary)

def write(*ary)
end

def flush
self
end
end
end
8 changes: 8 additions & 0 deletions test/test_events.rb
Expand Up @@ -97,6 +97,14 @@ def test_log_writes_to_stdout
assert_equal "ready\n", out
end

def test_null_log_does_nothing
out, _ = capture_io do
Puma::Events.null.log("ready")
end

assert_equal "", out
end

def test_write_writes_to_stdout
out, _ = capture_io do
Puma::Events.stdio.write("ready")
Expand Down
8 changes: 8 additions & 0 deletions test/test_null_io.rb
Expand Up @@ -56,4 +56,12 @@ def test_read_with_length_and_buffer
def test_size
assert_equal 0, nio.size
end

def test_sync_returns_true
assert_equal true, nio.sync
end

def test_flush_returns_self
assert_equal nio, nio.flush
end
end