test/cmd: add more shell tests.

This should help ensure that these don't regress.
This commit is contained in:
Mike McQuaid 2025-06-03 11:51:47 +01:00
parent 89739ac615
commit 76c4eb60ee
No known key found for this signature in database
5 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
RSpec.describe "brew casks", type: :system do
it "prints all installed Casks", :integration_test do
expect { brew_sh "casks" }
.to be_a_success
.and not_to_output.to_stderr
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
RSpec.describe "brew formulae", type: :system do
it "prints all installed Formulae", :integration_test do
expect { brew_sh "formulae" }
.to be_a_success
.and not_to_output.to_stderr
end
end

View File

@ -8,7 +8,7 @@ RSpec.describe Homebrew::Cmd::List do
it_behaves_like "parseable arguments"
it "prints all installed Formulae", :integration_test do
it "prints all installed formulae", :integration_test do
formulae.each do |f|
(HOMEBREW_CELLAR/f/"1.0/somedir").mkpath
end
@ -19,5 +19,9 @@ RSpec.describe Homebrew::Cmd::List do
.and be_a_success
end
# TODO: add a test for the shell fast-path (`brew_sh`)
it "prints all installed formulae and casks", :integration_test do
expect { brew_sh "list" }
.to be_a_success
.and not_to_output.to_stderr
end
end

View File

@ -0,0 +1,10 @@
# frozen_string_literal: true
RSpec.describe "brew setup-ruby", type: :system do
it "installs and configures Homebrew's Ruby", :integration_test do
expect { brew_sh "setup-ruby" }
.to output("").to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end

View File

@ -0,0 +1,10 @@
# frozen_string_literal: true
RSpec.describe "brew shellenv", type: :system do
it "prints export statements", :integration_test do
expect { brew_sh "shellenv" }
.to output(/.*/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end