mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	#N/A: Match git_add only if pathspec exists
				
					
				
			This commit is contained in:
		| @@ -3,6 +3,12 @@ from thefuck.rules.git_add import match, get_new_command | ||||
| from tests.utils import Command | ||||
|  | ||||
|  | ||||
| @pytest.fixture(autouse=True) | ||||
| def path_exists(mocker): | ||||
|     return mocker.patch('thefuck.rules.git_add.Path.exists', | ||||
|                         return_value=True) | ||||
|  | ||||
|  | ||||
| @pytest.fixture | ||||
| def stderr(target): | ||||
|     return ("error: pathspec '{}' did not match any " | ||||
| @@ -16,10 +22,13 @@ def test_match(stderr, script, target): | ||||
|     assert match(Command(script=script, stderr=stderr)) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('script', [ | ||||
|     'git submodule update known', 'git commit known']) | ||||
| def test_not_match(script): | ||||
|     assert not match(Command(script=script, stderr='')) | ||||
| @pytest.mark.parametrize('script, target, exists', [ | ||||
|     ('git submodule update known', '', True), | ||||
|     ('git commit known', '', True), | ||||
|     ('git submodule update known', stderr, False)]) | ||||
| def test_not_match(path_exists, stderr, script, target, exists): | ||||
|     path_exists.return_value = exists | ||||
|     assert not match(Command(script=script, stderr=stderr)) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('script, target, new_command', [ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user