2015-07-24 06:04:49 +01:00
|
|
|
def with_confirmation(proc):
|
|
|
|
"""Ensures that command can be fixed when confirmation enabled."""
|
2015-07-25 01:01:03 +01:00
|
|
|
proc.sendline('mkdir -p ~/.thefuck')
|
|
|
|
proc.sendline('echo "require_confirmation = True" > ~/.thefuck/settings.py')
|
|
|
|
|
2015-07-24 06:04:49 +01:00
|
|
|
proc.sendline('ehco test')
|
|
|
|
|
|
|
|
proc.sendline('fuck')
|
|
|
|
proc.expect('echo test')
|
|
|
|
proc.expect('enter')
|
|
|
|
proc.expect_exact('ctrl+c')
|
|
|
|
proc.send('\n')
|
|
|
|
|
|
|
|
proc.expect('test')
|
|
|
|
|
|
|
|
|
2015-07-24 21:14:58 +01:00
|
|
|
def refuse_with_confirmation(proc):
|
|
|
|
"""Ensures that fix can be refused when confirmation enabled."""
|
2015-07-25 01:01:03 +01:00
|
|
|
proc.sendline('mkdir -p ~/.thefuck')
|
|
|
|
proc.sendline('echo "require_confirmation = True" > ~/.thefuck/settings.py')
|
|
|
|
|
2015-07-24 21:14:58 +01:00
|
|
|
proc.sendline('ehco test')
|
|
|
|
|
|
|
|
proc.sendline('fuck')
|
|
|
|
proc.expect('echo test')
|
|
|
|
proc.expect('enter')
|
|
|
|
proc.expect_exact('ctrl+c')
|
|
|
|
proc.send('\003')
|
|
|
|
|
|
|
|
proc.expect('Aborted')
|
|
|
|
|
|
|
|
|
2015-07-24 06:04:49 +01:00
|
|
|
def without_confirmation(proc):
|
|
|
|
"""Ensures that command can be fixed when confirmation disabled."""
|
2015-07-25 01:01:03 +01:00
|
|
|
proc.sendline('mkdir -p ~/.thefuck')
|
|
|
|
proc.sendline('echo "require_confirmation = False" > ~/.thefuck/settings.py')
|
|
|
|
|
2015-07-24 06:04:49 +01:00
|
|
|
proc.sendline('ehco test')
|
|
|
|
|
|
|
|
proc.sendline('fuck')
|
|
|
|
proc.expect('echo test')
|
|
|
|
proc.expect('test')
|