test/cmd/list_spec: remove an integration test

This commit is contained in:
Ruoyu Zhong 2024-04-23 15:46:31 +08:00
parent 4e0c7868b3
commit 107b8c7ca5
No known key found for this signature in database

View File

@ -2,24 +2,8 @@
require "cmd/list"
require "cmd/shared_examples/args_parse"
require "tab"
RSpec.describe Homebrew::Cmd::List do
def setup_installation(formula_name, installed_on_request:)
setup_test_formula(formula_name)
keg_dir = HOMEBREW_CELLAR/formula_name/"1.0"
keg_dir.mkpath
tab = Tab.new(
"installed_on_request" => installed_on_request,
"tabfile" => keg_dir/Tab::FILENAME,
)
tab.write
keg_dir
end
let(:formulae) { %w[bar foo qux] }
it_behaves_like "parseable arguments"
@ -34,25 +18,4 @@ RSpec.describe Homebrew::Cmd::List do
.and not_to_output.to_stderr
.and be_a_success
end
it "lists the formulae installed on request or automatically",
:integration_test do
setup_installation "foo", installed_on_request: true
setup_installation "bar", installed_on_request: false
expect { brew "list", "--manual" }
.to be_a_success
.and output("foo\n").to_stdout
.and not_to_output.to_stderr
expect { brew "list", "--auto" }
.to be_a_success
.and output("bar\n").to_stdout
.and not_to_output.to_stderr
expect { brew "list", "--manual", "--auto" }
.to be_a_success
.and output("bar: auto\nfoo: manual\n").to_stdout
.and not_to_output.to_stderr
end
end