<commit_before>dir = File.dirname(__FILE__)
require File.expand_path("#{dir}/../spec_helper")
require File.expand_path("#{dir}/../../lib/geminstaller/gem_command_proxy")
require File.expand_path("#{dir}/../../lib/geminstaller/dependency_injector")
require File.expand_path("#{dir}/../../lib/geminstaller/ruby_gem")

# NOTE: this test is dependent upon RubyGems being installed, and write permissions (or sudo) to gem install dir
context "a GemCommandProxy instance" do
  setup do
    @sample_gem = GemInstaller::RubyGem.new("ruby-doom","0.8",["--source", "http://gems.rubyforge.org"])
    @gem_command_proxy = GemInstaller::DependencyInjector.new.registry.gem_command_proxy

    # setup to make sure gem is not installed before test
    if (@gem_command_proxy.is_gem_installed(@sample_gem)) then
      @gem_command_proxy.uninstall_gem(@sample_gem)
    end
    @gem_command_proxy.is_gem_installed(@sample_gem).should_equal(false)
  end

  specify "should be able to install and delete a gem" do
    @gem_command_proxy.install_gem(@sample_gem)

    @gem_command_proxy.is_gem_installed(@sample_gem).should_equal(true)

    # uninstall it again after we are done
    @gem_command_proxy.uninstall_gem(@sample_gem)
    @gem_command_proxy.is_gem_installed(@sample_gem).should_equal(false)
  end
  
end
<commit_msg>add a nice comment<commit_after>dir = File.dirname(__FILE__)
require File.expand_path("#{dir}/../spec_helper")
require File.expand_path("#{dir}/../../lib/geminstaller/gem_command_proxy")
require File.expand_path("#{dir}/../../lib/geminstaller/dependency_injector")
require File.expand_path("#{dir}/../../lib/geminstaller/ruby_gem")

# NOTE: this test is dependent upon
# * RubyGems being installed
# * write permissions (or sudo) to gem install dir
# * rubyforge.org being up and accessible
# If rubyforge.org is down or inaccessible, you can point the --source option to a local server running gem_server
context "a GemCommandProxy instance" do
  setup do
    @sample_gem = GemInstaller::RubyGem.new("ruby-doom","0.8",["--source", "http://gems.rubyforge.org"])
    @gem_command_proxy = GemInstaller::DependencyInjector.new.registry.gem_command_proxy

    # setup to make sure gem is not installed before test
    if (@gem_command_proxy.is_gem_installed(@sample_gem)) then
      @gem_command_proxy.uninstall_gem(@sample_gem)
    end
    @gem_command_proxy.is_gem_installed(@sample_gem).should_equal(false)
  end

  specify "should be able to install and delete a gem" do
    @gem_command_proxy.install_gem(@sample_gem)

    @gem_command_proxy.is_gem_installed(@sample_gem).should_equal(true)

    # uninstall it again after we are done
    @gem_command_proxy.uninstall_gem(@sample_gem)
    @gem_command_proxy.is_gem_installed(@sample_gem).should_equal(false)
  end
  
end

{'fraction_non_alphanumeric': 0.12126664267722202, 'fraction_numerical': 0.0014393666786613889, 'mean_word_length': 5.056644880174292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4320506', 'n_tokens_mistral': 906, 'n_tokens_neox': 869, 'n_words': 187}