Skip to content
Snippets Groups Projects
Commit 2080c360 authored by Nath Tumlin's avatar Nath Tumlin
Browse files

Added tests for highlight installed and fixed style errors

parent 250f3445
No related branches found
No related tags found
No related merge requests found
...@@ -49,15 +49,12 @@ module Hbc ...@@ -49,15 +49,12 @@ module Hbc
else else
ohai "Partial matches" ohai "Partial matches"
end end
highlighted = partial_matches.map { |match| highlight_installed match } puts Formatter.columns(partial_matches.map(&method(:highlight_installed)))
puts Formatter.columns(highlighted)
end end
def self.highlight_installed(token) def self.highlight_installed(token)
if Cask.new(token).installed? return token unless Cask.new(token).installed?
token = pretty_installed token pretty_installed token
end
token
end end
def self.help def self.help
......
...@@ -56,4 +56,16 @@ describe Hbc::CLI::Search, :cask do ...@@ -56,4 +56,16 @@ describe Hbc::CLI::Search, :cask do
Hbc::CLI::Search.run("caskroom") Hbc::CLI::Search.run("caskroom")
}.to output(/^No Cask found for "caskroom"\.\n/).to_stdout }.to output(/^No Cask found for "caskroom"\.\n/).to_stdout
end end
it "doesn't highlight not installed packages" do
expect(Hbc::CLI::Search.highlight_installed "local-caffeine").to eq("local-caffeine")
end
it "highlights installed packages" do
shutup do
Hbc::CLI::Install.run("local-caffeine")
end
expect(Hbc::CLI::Search.highlight_installed "local-caffeine").to eq(pretty_installed "local-caffeine")
end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment