diff options
| author | Markus Reiter | 2017-03-05 06:31:36 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-03-05 23:08:14 +0100 |
| commit | 9fc6c7b2be300ff35dc52d80f4dc38d36d52ddc2 (patch) | |
| tree | 43e99a683329471c1dc965dcc92daccb57df7e8d /Library/Homebrew/test/cask/cli/search_spec.rb | |
| parent | 67ec76d1492fbb03959a782a85c4fb985d6a5884 (diff) | |
| download | brew-9fc6c7b2be300ff35dc52d80f4dc38d36d52ddc2.tar.bz2 | |
Move Cask specs into `brew tests`.
Diffstat (limited to 'Library/Homebrew/test/cask/cli/search_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/cask/cli/search_spec.rb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cask/cli/search_spec.rb b/Library/Homebrew/test/cask/cli/search_spec.rb new file mode 100644 index 000000000..0bcff809a --- /dev/null +++ b/Library/Homebrew/test/cask/cli/search_spec.rb @@ -0,0 +1,59 @@ +describe Hbc::CLI::Search, :cask do + it "lists the available Casks that match the search term" do + expect { + Hbc::CLI::Search.run("local") + }.to output(<<-EOS.undent).to_stdout + ==> Partial matches + local-caffeine + local-transmission + EOS + end + + it "shows that there are no Casks matching a search term that did not result in anything" do + expect { + Hbc::CLI::Search.run("foo-bar-baz") + }.to output("No Cask found for \"foo-bar-baz\".\n").to_stdout + end + + it "lists all available Casks with no search term" do + expect { + Hbc::CLI::Search.run + }.to output(/local-caffeine/).to_stdout + end + + it "ignores hyphens in search terms" do + expect { + Hbc::CLI::Search.run("lo-cal-caffeine") + }.to output(/local-caffeine/).to_stdout + end + + it "ignores hyphens in Cask tokens" do + expect { + Hbc::CLI::Search.run("localcaffeine") + }.to output(/local-caffeine/).to_stdout + end + + it "accepts multiple arguments" do + expect { + Hbc::CLI::Search.run("local caffeine") + }.to output(/local-caffeine/).to_stdout + end + + it "accepts a regexp argument" do + expect { + Hbc::CLI::Search.run("/^local-c[a-z]ffeine$/") + }.to output("==> Regexp matches\nlocal-caffeine\n").to_stdout + end + + it "Returns both exact and partial matches" do + expect { + Hbc::CLI::Search.run("test-opera") + }.to output(/^==> Exact match\ntest-opera\n==> Partial matches\ntest-opera-mail/).to_stdout + end + + it "does not search the Tap name" do + expect { + Hbc::CLI::Search.run("caskroom") + }.to output(/^No Cask found for "caskroom"\.\n/).to_stdout + end +end |
