From 537392ff9d587dc65b90e4c0a03195ae81a5e4f5 Mon Sep 17 00:00:00 2001 From: Schneems Date: Mon, 16 Dec 2024 11:45:37 -0600 Subject: [PATCH] Fix Background::Wait and exercise in test. I accidentally used `name` instead of `@name` and apparently this functionality is not called under test. So I added tests. Before: ``` 87 runs, 251 assertions, 0 failures, 0 errors, 0 skips Coverage report generated for Integration Tests to /Users/rschneeman/Documents/projects/rundoc/coverage. Line Coverage: 95.32% (1998 / 2096) ``` After: ``` 87 runs, 251 assertions, 0 failures, 0 errors, 0 skips Coverage report generated for Integration Tests to /Users/rschneeman/Documents/projects/rundoc/coverage. Line Coverage: 95.66% (2006 / 2097) ``` --- CHANGELOG.md | 2 ++ lib/rundoc/code_command/background/wait.rb | 2 +- test/rundoc/code_commands/background_test.rb | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15d8bfa..1dad8b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## HEAD +- Fix: Internal error in `background.wait` introduced in 4.1.2 (https://github.com/zombocom/rundoc/pull/97) + ## 4.1.2 - Fix: Background task name lookup is now lazy, this fixes a bug when using `:::>- pre.erb background.start(...)` (https://github.com/zombocom/rundoc/pull/95) diff --git a/lib/rundoc/code_command/background/wait.rb b/lib/rundoc/code_command/background/wait.rb index 5de3747..0d0d5c7 100644 --- a/lib/rundoc/code_command/background/wait.rb +++ b/lib/rundoc/code_command/background/wait.rb @@ -8,7 +8,7 @@ def initialize(name:, wait:, timeout: 5) end def background - @background ||= Rundoc::CodeCommand::Background::ProcessSpawn.find(name) + @background ||= Rundoc::CodeCommand::Background::ProcessSpawn.find(@name) end def to_md(env = {}) diff --git a/test/rundoc/code_commands/background_test.rb b/test/rundoc/code_commands/background_test.rb index e17331c..0636e78 100644 --- a/test/rundoc/code_commands/background_test.rb +++ b/test/rundoc/code_commands/background_test.rb @@ -19,6 +19,11 @@ def test_stdin_with_cat_echo output = stdin_write.call assert_equal("hello there" + $/, output) + Rundoc::CodeCommand::Background::Wait.new( + name: "cat", + wait: "hello" + ).call + Rundoc::CodeCommand::Background::Log::Clear.new( name: "cat" ).call