2017-01-28 13:18:23 -05:00
|
|
|
import pytest
|
|
|
|
from thefuck.rules.git_add_force import match, get_new_command
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2017-01-28 13:18:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2017-08-31 17:58:56 +02:00
|
|
|
def output():
|
2017-01-28 13:18:23 -05:00
|
|
|
return ('The following paths are ignored by one of your .gitignore files:\n'
|
|
|
|
'dist/app.js\n'
|
|
|
|
'dist/background.js\n'
|
|
|
|
'dist/options.js\n'
|
|
|
|
'Use -f if you really want to add them.\n')
|
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
def test_match(output):
|
|
|
|
assert match(Command('git add dist/*.js', output))
|
|
|
|
assert not match(Command('git add dist/*.js', ''))
|
2017-01-28 13:18:23 -05:00
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
def test_get_new_command(output):
|
|
|
|
assert (get_new_command(Command('git add dist/*.js', output))
|
2017-03-08 12:39:24 -05:00
|
|
|
== "git add --force dist/*.js")
|