mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-24 03:28:59 +00:00
26 lines
817 B
Python
26 lines
817 B
Python
|
import pytest
|
||
|
from thefuck.rules.rbenv_install import match, get_new_command
|
||
|
from thefuck.types import Command
|
||
|
|
||
|
expected_new_command = """cd /home/alex/.rbenv/plugins/ruby-build && git pull && cd -"""
|
||
|
expected_output = """ruby-build: definition not found: 2.6.1
|
||
|
|
||
|
See all available versions with `rbenv install --list'.
|
||
|
|
||
|
If the version you need is missing, try upgrading ruby-build:
|
||
|
|
||
|
%s""" % expected_new_command
|
||
|
|
||
|
|
||
|
@pytest.mark.parametrize('script, output', [
|
||
|
('rbenv install 2.6.1', expected_output)
|
||
|
])
|
||
|
def test_match(script, output):
|
||
|
assert match(Command(script, output))
|
||
|
|
||
|
|
||
|
@pytest.mark.parametrize('command, new_command', [
|
||
|
(Command('rbenv install 2.6.1', expected_output), expected_new_command)])
|
||
|
def test_get_new_command(command, new_command):
|
||
|
assert get_new_command(command) == new_command
|