def METHOD_NAME(self):
    # XXX: This test is also extremely fragile because of mocking.
    #      If this breaks, the only that matters is to check whether '--install-dir' is
    #      in the run command, and that GEM_HOME is passed to the command.
    set_module_args({
        'name': 'dummy',
        'user_install': False,
        'install_dir': '/opt/dummy',
        'state': 'absent',
    })
    self.patch_rubygems_version()
    self.patch_installed_versions(['1.0.0'])
    run_command = self.patch_run_command()
    with pytest.raises(AnsibleExitJson) as exc:
        gem.main()
    result = exc.value.args[0]
    assert result['changed']
    assert run_command.called
    assert '--install-dir /opt/dummy' in get_command(run_command)
    update_environ = run_command.call_args[1].get('environ_update', {})
    assert update_environ.get('GEM_HOME') == '/opt/dummy'