[rubygems/rubygems] Fix binstub test bug

the overwritten binstub in the test has a final new line that makes it
not match "OMG" exactly from the beginning, that's why the test passes,
but `bintubs` command without `--force` flag is not supposed to update
the binstub.

This change fixes the test to test what's supposed to update the
binstub, and also fixes the assertion that that it will fail in the
future if `--force` stops updating the binstub.

https://github.com/rubygems/rubygems/commit/dfc9023337
This commit is contained in:
sodacris 2024-11-18 15:53:34 +08:00 committed by git
parent 492b379b52
commit dd473cec29

View File

@ -126,7 +126,7 @@ RSpec.describe "Running bin/* commands" do
expect(bundled_app("bin/myrackup")).to exist
end
it "rewrites bins on binstubs (to maintain backwards compatibility)" do
it "rewrites bins on binstubs with --force option" do
install_gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@ -134,9 +134,9 @@ RSpec.describe "Running bin/* commands" do
create_file("bin/myrackup", "OMG")
bundle "binstubs myrack"
bundle "binstubs myrack", { force: true }
expect(bundled_app("bin/myrackup").read).to_not eq("OMG")
expect(bundled_app("bin/myrackup").read.strip).to_not eq("OMG")
end
it "use BUNDLE_GEMFILE gemfile for binstub" do