Skip to content

Commit a33d141

Browse files
committed
Don't rely on which for testing ContinuousIntegration
While very common, `which` isn't portable. But more importantly in this case it is used to get either a failing or successful command, so it's much simpler to use `true` and `false` for that.
1 parent bcd5c93 commit a33d141

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

activesupport/test/continuous_integration_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ class ContinuousIntegrationTest < ActiveSupport::TestCase
77
setup { @CI = ActiveSupport::ContinuousIntegration.new }
88

99
test "successful step" do
10-
output = capture_io { @CI.step "Success!", "which ruby > /dev/null" }.to_s
10+
output = capture_io { @CI.step "Success!", "true" }.to_s
1111
assert_match(/Success! passed/, output)
1212
assert @CI.success?
1313
end
1414

1515
test "failed step" do
16-
output = capture_io { @CI.step "Failed!", "which rubyxx > /dev/null" }.to_s
16+
output = capture_io { @CI.step "Failed!", "false" }.to_s
1717
assert_match(/Failed! failed/, output)
1818
assert_not @CI.success?
1919
end
2020

2121
test "report with only successful steps combined gives success" do
2222
output = capture_io do
2323
@CI.report("CI") do
24-
step "Success!", "which ruby > /dev/null"
25-
step "Success again!", "which ruby > /dev/null"
24+
step "Success!", "true"
25+
step "Success again!", "true"
2626
end
2727
end.to_s
2828

@@ -33,8 +33,8 @@ class ContinuousIntegrationTest < ActiveSupport::TestCase
3333
test "report with successful and failed steps combined gives failure" do
3434
output = capture_io do
3535
@CI.report("CI") do
36-
step "Success!", "which ruby > /dev/null"
37-
step "Failed!", "which rubyxx > /dev/null"
36+
step "Success!", "true"
37+
step "Failed!", "false"
3838
end
3939
end.to_s
4040

0 commit comments

Comments
 (0)