summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-14 10:50:58 +0200
committerPaul Buetow <paul@buetow.org>2026-03-14 10:50:58 +0200
commit2b4c2d4bbb47b59fb8bf7fec027efd36b1352857 (patch)
treecb45c69664461df14b90c47f2dd55ef4107e5e91 /test/lib
parent8a641ff347d0584ea1ddc16a6ef81a8c16ab172d (diff)
Validate agent configs during dry runs
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/dslkeywords/agent_test.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/lib/dslkeywords/agent_test.rb b/test/lib/dslkeywords/agent_test.rb
index 5eb5bc5..d3fc49f 100644
--- a/test/lib/dslkeywords/agent_test.rb
+++ b/test/lib/dslkeywords/agent_test.rb
@@ -283,6 +283,43 @@ class RCMAgentTest < Minitest::Test
assert_equal 'keep me', File.read(file_path)
end
+ def test_dry_run_unknown_agent_raises
+ file_path = path('dry-run-unknown-agent.txt')
+ File.write(file_path, 'keep me')
+ ARGV.replace(['--dry'])
+
+ assert_raises(RCM::DSL::NoSuchAgentDefinition) do
+ configure_from_scratch do
+ prompt 'no op' do
+ ''
+ end
+
+ file file_path do
+ agent 'missing agent', 'no op'
+ end
+ end
+ end
+ end
+
+ def test_dry_run_unknown_prompt_raises
+ file_path = path('dry-run-unknown-prompt.txt')
+ command = mock_agent_command(:pass_through)
+ File.write(file_path, 'keep me')
+ ARGV.replace(['--dry'])
+
+ assert_raises(RCM::DSL::NoSuchPromptDefinition) do
+ configure_from_scratch do
+ agent mock do
+ command
+ end
+
+ file file_path do
+ agent mock, 'missing prompt'
+ end
+ end
+ end
+ end
+
def test_non_zero_exit_raises
file_path = path('broken.txt')
command = mock_agent_command(:fail, 'boom', '7')