2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-03-29 18:15:31 -07:00
|
|
|
require "cmd/desc"
|
2019-03-28 08:35:36 +00:00
|
|
|
require "cmd/shared_examples/args_parse"
|
|
|
|
|
2024-03-29 18:15:31 -07:00
|
|
|
RSpec.describe Homebrew::Cmd::Desc do
|
2019-03-28 08:35:36 +00:00
|
|
|
it_behaves_like "parseable arguments"
|
|
|
|
|
2021-02-01 16:14:25 -05:00
|
|
|
it "shows a given Formula's description", :integration_test do
|
2017-02-23 06:02:59 +01:00
|
|
|
setup_test_formula "testball"
|
|
|
|
|
2024-04-17 23:42:09 +01:00
|
|
|
expect { brew "desc", "testball" }
|
2017-02-23 06:02:59 +01:00
|
|
|
.to output("testball: Some test\n").to_stdout
|
|
|
|
.and not_to_output.to_stderr
|
|
|
|
.and be_a_success
|
|
|
|
end
|
2024-04-17 23:42:09 +01:00
|
|
|
|
|
|
|
it "errors when searching without --eval-all", :integration_test do
|
|
|
|
setup_test_formula "testball"
|
|
|
|
|
|
|
|
expect { brew "desc", "--search", "testball" }
|
2025-01-27 14:21:27 +00:00
|
|
|
.to output(/`brew desc --search` needs `--eval-all` passed or `\$HOMEBREW_EVAL_ALL` set!/).to_stderr
|
2024-04-17 23:42:09 +01:00
|
|
|
.and be_a_failure
|
|
|
|
end
|
|
|
|
|
|
|
|
it "successfully searches with --search --eval-all", :integration_test do
|
|
|
|
setup_test_formula "testball"
|
|
|
|
|
|
|
|
expect { brew "desc", "--search", "--eval-all", "ball" }
|
|
|
|
.to output(/testball: Some test/).to_stdout
|
|
|
|
.and not_to_output.to_stderr
|
|
|
|
end
|
2024-06-30 18:53:57 -04:00
|
|
|
|
2025-02-04 16:05:35 -05:00
|
|
|
it "successfully searches without --eval-all, with API", :integration_test, :needs_network do
|
2024-06-30 18:53:57 -04:00
|
|
|
setup_test_formula "testball"
|
|
|
|
|
|
|
|
expect { brew "desc", "--search", "testball", "HOMEBREW_NO_INSTALL_FROM_API" => nil }
|
|
|
|
.to be_a_success
|
|
|
|
end
|
2017-02-23 06:02:59 +01:00
|
|
|
end
|