Merge pull request #20040 from Homebrew/brew_sh_tests

test/cmd: add more shell tests.
This commit is contained in:
Mike McQuaid 2025-06-03 14:33:47 +00:00 committed by GitHub
commit 21e3621132
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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