allow @ and + characters for search
This commit is contained in:
		
							parent
							
								
									42c11a4ded
								
							
						
					
					
						commit
						47e70ab3ea
					
				@ -150,7 +150,7 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def self.simplify_string(string)
 | 
			
		||||
      string.downcase.gsub(/[^a-z\d]/i, "")
 | 
			
		||||
      string.downcase.gsub(/[^a-z\d@+]/i, "")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def self.search_regex(selectable, regex)
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ RSpec.describe Homebrew::Search do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "#search" do
 | 
			
		||||
    let(:collection) { ["with-dashes"] }
 | 
			
		||||
    let(:collection) { ["with-dashes", "with@alpha", "with+plus"] }
 | 
			
		||||
 | 
			
		||||
    context "when given a block" do
 | 
			
		||||
      let(:collection) { [["with-dashes", "withdashes"]] }
 | 
			
		||||
@ -41,6 +41,11 @@ RSpec.describe Homebrew::Search do
 | 
			
		||||
      it "simplifies both the query and searched strings" do
 | 
			
		||||
        expect(described_class.search(collection, "with dashes")).to eq ["with-dashes"]
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "does not simplify strings with @ and + characters" do
 | 
			
		||||
        expect(described_class.search(collection, "with@alpha")).to eq ["with@alpha"]
 | 
			
		||||
        expect(described_class.search(collection, "with+plus")).to eq ["with+plus"]
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context "when searching a Hash" do
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user