def test_install_ruby_system(fake_gem_prefix): ruby.install_environment(fake_gem_prefix, 'system', ()) # Should be able to activate and use rbenv install with ruby.in_env(fake_gem_prefix, 'system'): _, out, _ = cmd_output('gem', 'list') assert 'pre_commit_placeholder_package' in out
def test_install_rbenv_with_version(tempdir_factory): prefix = Prefix(tempdir_factory.get()) ruby._install_rbenv(prefix, version='1.9.3p547') # Should be able to activate and use rbenv install with ruby.in_env(prefix, '1.9.3p547'): cmd_output('rbenv', 'install', '--help')
def test_additional_ruby_dependencies_installed(tempdir_factory, store): path = make_repo(tempdir_factory, 'ruby_hooks_repo') config = make_config_from_repo(path) config['hooks'][0]['additional_dependencies'] = ['tins'] hook = _get_hook(config, store, 'ruby_hook') with ruby.in_env(hook.prefix, hook.language_version): output = cmd_output('gem', 'list', '--local')[1] assert 'tins' in output
def test_install_ruby_default(fake_gem_prefix): ruby.install_environment(fake_gem_prefix, C.DEFAULT, ()) # Should have created rbenv directory assert os.path.exists(fake_gem_prefix.path('rbenv-default')) # Should be able to activate using our script and access rbenv with ruby.in_env(fake_gem_prefix, 'default'): cmd_output('rbenv', '--help')
def test_install_rbenv(tempdir_factory): prefix = Prefix(tempdir_factory.get()) ruby._install_rbenv(prefix) # Should have created rbenv directory assert os.path.exists(prefix.path('rbenv-default')) # Should be able to activate using our script and access rbenv with ruby.in_env(prefix, 'default'): cmd_output('rbenv', '--help')
def test_additional_ruby_dependencies_installed( tempdir_factory, store, ): # pragma: no cover (non-windows) path = make_repo(tempdir_factory, 'ruby_hooks_repo') config = make_config_from_repo(path) config['hooks'][0]['additional_dependencies'] = ['thread_safe'] repo = Repository.create(config, store) repo.run_hook(repo.hooks[0][1], []) with ruby.in_env(repo.cmd_runner, 'default') as env: output = env.run('gem list --local')[1] assert 'thread_safe' in output
def test_additional_ruby_dependencies_installed( tempdir_factory, store, ): # pragma: no cover (non-windows) path = make_repo(tempdir_factory, 'ruby_hooks_repo') config = make_config_from_repo(path) config['hooks'][0]['additional_dependencies'] = ['thread_safe'] repo = Repository.create(config, store) repo.require_installed() with ruby.in_env(repo.cmd_runner, 'default'): output = cmd_output('gem', 'list', '--local')[1] assert 'thread_safe' in output
def test_additional_ruby_dependencies_installed( tempdir_factory, store, ): # pragma: no cover (non-windows) path = make_repo(tempdir_factory, 'ruby_hooks_repo') config = make_config_from_repo(path) config['hooks'][0]['additional_dependencies'] = ['thread_safe', 'tins'] repo = Repository.create(config, store) repo.require_installed() with ruby.in_env(repo._cmd_runner, 'default'): output = cmd_output('gem', 'list', '--local')[1] assert 'thread_safe' in output assert 'tins' in output
def test_install_ruby_with_version(fake_gem_prefix): ruby.install_environment(fake_gem_prefix, '2.7.2', ()) # Should be able to activate and use rbenv install with ruby.in_env(fake_gem_prefix, '2.7.2'): cmd_output('rbenv', 'install', '--help')