Commit 787345f1 authored by Kyle Fuller's avatar Kyle Fuller

[Search] Don't validate for valid regex on web searchs

parent a3ec49e2
...@@ -36,10 +36,14 @@ module Pod ...@@ -36,10 +36,14 @@ module Pod
super super
help! "A search query is required." unless @query help! "A search query is required." unless @query
unless @web
begin
/#{@query.join(' ').strip}/ /#{@query.join(' ').strip}/
rescue RegexpError rescue RegexpError
help! "A valid regular expression is required." help! "A valid regular expression is required."
end end
end
end
def run def run
if @web if @web
......
...@@ -50,7 +50,7 @@ module Pod ...@@ -50,7 +50,7 @@ module Pod
output.should.include? 'BananaLib' output.should.include? 'BananaLib'
end end
it "shows a friendly message when searching with invalid regex" do it "shows a friendly message when locally searching with invalid regex" do
lambda { run_command('search', '+') }.should.raise CLAide::Help lambda { run_command('search', '+') }.should.raise CLAide::Help
end end
...@@ -58,6 +58,11 @@ module Pod ...@@ -58,6 +58,11 @@ module Pod
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "searches with invalid regex" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=NSAttributedString+CCLFormat')
run_command('search', '--web', 'NSAttributedString+CCLFormat')
end
it "searches the web via the open! command" do it "searches the web via the open! command" do
Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=bananalib') Command::Search.any_instance.expects(:open!).with('http://cocoapods.org/?q=bananalib')
run_command('search', '--web', 'bananalib') run_command('search', '--web', 'bananalib')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment