Skip to content

Commit 21e3621

Browse files
authored
Merge pull request #20040 from Homebrew/brew_sh_tests
test/cmd: add more shell tests.
2 parents 89739ac + 76c4eb6 commit 21e3621

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe "brew casks", type: :system do
4+
it "prints all installed Casks", :integration_test do
5+
expect { brew_sh "casks" }
6+
.to be_a_success
7+
.and not_to_output.to_stderr
8+
end
9+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe "brew formulae", type: :system do
4+
it "prints all installed Formulae", :integration_test do
5+
expect { brew_sh "formulae" }
6+
.to be_a_success
7+
.and not_to_output.to_stderr
8+
end
9+
end

Library/Homebrew/test/cmd/list_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
it_behaves_like "parseable arguments"
1010

11-
it "prints all installed Formulae", :integration_test do
11+
it "prints all installed formulae", :integration_test do
1212
formulae.each do |f|
1313
(HOMEBREW_CELLAR/f/"1.0/somedir").mkpath
1414
end
@@ -19,5 +19,9 @@
1919
.and be_a_success
2020
end
2121

22-
# TODO: add a test for the shell fast-path (`brew_sh`)
22+
it "prints all installed formulae and casks", :integration_test do
23+
expect { brew_sh "list" }
24+
.to be_a_success
25+
.and not_to_output.to_stderr
26+
end
2327
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe "brew setup-ruby", type: :system do
4+
it "installs and configures Homebrew's Ruby", :integration_test do
5+
expect { brew_sh "setup-ruby" }
6+
.to output("").to_stdout
7+
.and not_to_output.to_stderr
8+
.and be_a_success
9+
end
10+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe "brew shellenv", type: :system do
4+
it "prints export statements", :integration_test do
5+
expect { brew_sh "shellenv" }
6+
.to output(/.*/).to_stdout
7+
.and not_to_output.to_stderr
8+
.and be_a_success
9+
end
10+
end

0 commit comments

Comments
 (0)