diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/lib/dslkeywords/agent_test.rb | 37 |
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') |
