<commit_before>require 'test_helper'

class GemTest < ActiveSupport::TestCase
  
  context "gem with version" do
    setup do
      @gem = Mactag::Tag::Gem.new("thinking-sphinx", :version => "1.0.0")
    end
    
    should "return the gem with that version" do
      assert_contains @gem.files, File.join(Mactag::Config.gem_home, "thinking-sphinx-1.0.0", "**", "*.rb")
    end
  end
  
end<commit_msg>Test other cases aswell in gem tag test using stubs.<commit_after>require 'test_helper'

class GemTest < ActiveSupport::TestCase
  
  context "gem with version" do
    setup do
      @gem = Mactag::Tag::Gem.new("thinking-sphinx", :version => "1.0.0")
    end
    
    should "return the gem with that version" do
      assert_contains @gem.files, File.join(Mactag::Config.gem_home, "thinking-sphinx-1.0.0", "**", "*.rb")
    end
  end
  
  context "gem without version" do
    context "one gem" do
      setup do
        Dir.stubs(:glob).returns("whenever")

        @gem = Mactag::Tag::Gem.new("whenever")
      end
      
      should "return that gem" do
        assert_contains @gem.files, "whenever/**/*.rb"
      end
    end
    
    context "multiple gems" do
      setup do
        Dir.stubs(:glob).returns(["whenever-0.3.7", "whenever-0.3.6"])
        
        @gem = Mactag::Tag::Gem.new("whenever")
      end
      
      should "return the gem with the latest version" do
        assert_contains @gem.files, "whenever-0.3.7/**/*.rb"
        assert_does_not_contain @gem.files, "whenever-0.3.6/**/*.rb"
      end
    end
  end
  
end
{'fraction_non_alphanumeric': 0.1403622250970246, 'fraction_numerical': 0.015523932729624839, 'mean_word_length': 2.540045766590389, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1333394', 'n_tokens_mistral': 542, 'n_tokens_neox': 535, 'n_words': 128}