@@ -269,46 +269,15 @@ def test_no_delay_with_single_iteration(self, mock_run, mock_sleep, tmp_path, mo
269269 mock_sleep .assert_not_called ()
270270
271271
272- class TestRunAdHocPrompt :
273- @ patch ( "ralphify._agent.subprocess.run" , side_effect = _ok )
274- def test_uses_provided_prompt_text ( self , mock_run , tmp_path , monkeypatch ):
272+ class TestRunRejectsInlinePrompt :
273+ def test_unknown_name_errors ( self , tmp_path , monkeypatch ):
274+ """A value that doesn't match a named ralph produces an error."""
275275 monkeypatch .chdir (tmp_path )
276276 (tmp_path / CONFIG_FILENAME ).write_text (RALPH_TOML_TEMPLATE )
277277
278278 result = runner .invoke (app , ["run" , "do something" , "-n" , "1" ])
279- assert result .exit_code == 0
280- assert mock_run .call_args .kwargs ["input" ] == "do something"
281-
282- @patch ("ralphify._agent.subprocess.run" , side_effect = _ok )
283- def test_skips_ralph_file_check (self , mock_run , tmp_path , monkeypatch ):
284- """Works without RALPH.md when inline text is provided."""
285- monkeypatch .chdir (tmp_path )
286- (tmp_path / CONFIG_FILENAME ).write_text (RALPH_TOML_TEMPLATE )
287- # No RALPH.md created
288-
289- result = runner .invoke (app , ["run" , "ad-hoc prompt" , "-n" , "1" ])
290- assert result .exit_code == 0
291- assert mock_run .call_count == 1
292-
293- @patch ("ralphify._agent.subprocess.run" , side_effect = _ok )
294- def test_file_path_used_as_prompt (self , mock_run , tmp_path , monkeypatch ):
295- """An existing file path is used as the prompt file."""
296- monkeypatch .chdir (tmp_path )
297- (tmp_path / CONFIG_FILENAME ).write_text (RALPH_TOML_TEMPLATE )
298- (tmp_path / "alt.md" ).write_text ("alternate prompt" )
299-
300- result = runner .invoke (app , ["run" , "alt.md" , "-n" , "1" ])
301- assert result .exit_code == 0
302- assert mock_run .call_args .kwargs ["input" ] == "alternate prompt"
303-
304- def test_nonexistent_file_treated_as_inline (self , tmp_path , monkeypatch ):
305- """A non-existent path-like string is treated as inline text."""
306- monkeypatch .chdir (tmp_path )
307- (tmp_path / CONFIG_FILENAME ).write_text (RALPH_TOML_TEMPLATE )
308-
309- # "nonexistent.md" doesn't exist as a file, and doesn't match a ralph name,
310- # so it's treated as inline text
311- result = runner .invoke (app , ["run" , "nonexistent.md" , "-n" , "1" ])
279+ assert result .exit_code == 1
280+ assert "not found" in result .output .lower ()
312281
313282
314283class TestRunLogging :
@@ -909,15 +878,14 @@ def test_run_with_ralph_name(self, mock_run, tmp_path, monkeypatch):
909878 assert result .exit_code == 0
910879 assert mock_run .call_args .kwargs ["input" ] == "Fix the docs."
911880
912- @patch ("ralphify._agent.subprocess.run" , side_effect = _ok )
913- def test_nonexistent_name_treated_as_inline_text (self , mock_run , tmp_path , monkeypatch ):
914- """A value that doesn't match a ralph or file is treated as inline text."""
881+ def test_nonexistent_name_errors (self , tmp_path , monkeypatch ):
882+ """A value that doesn't match a named ralph produces an error."""
915883 monkeypatch .chdir (tmp_path )
916884 (tmp_path / CONFIG_FILENAME ).write_text (RALPH_TOML_TEMPLATE )
917885
918886 result = runner .invoke (app , ["run" , "nonexistent" , "-n" , "1" ])
919- assert result .exit_code == 0
920- assert mock_run . call_args . kwargs [ "input" ] == "nonexistent"
887+ assert result .exit_code == 1
888+ assert "not found" in result . output . lower ()
921889
922890 @patch ("ralphify._agent.subprocess.run" , side_effect = _ok )
923891 def test_run_without_name_falls_back_to_toml (self , mock_run , tmp_path , monkeypatch ):
@@ -941,11 +909,11 @@ def test_toml_ralph_as_name(self, mock_run, tmp_path, monkeypatch):
941909 assert result .exit_code == 0
942910 assert mock_run .call_args .kwargs ["input" ] == "Fix the docs."
943911
944- @ patch ( "ralphify._agent.subprocess.run" , side_effect = _ok )
945- def test_inline_prompt_used_when_not_ralph_or_file ( self , mock_run , tmp_path , monkeypatch ):
912+ def test_inline_text_rejected ( self , tmp_path , monkeypatch ):
913+ """Inline text that isn't a ralph name produces an error."""
946914 monkeypatch .chdir (tmp_path )
947915 (tmp_path / CONFIG_FILENAME ).write_text (RALPH_TOML_TEMPLATE )
948916
949917 result = runner .invoke (app , ["run" , "inline text" , "-n" , "1" ])
950- assert result .exit_code == 0
951- assert mock_run . call_args . kwargs [ "input" ] == "inline text"
918+ assert result .exit_code == 1
919+ assert "not found" in result . output . lower ()
0 commit comments