[rubygems/rubygems] Fix test task name on generated readme when using test-unit

* bundler/lib/bundler/templates/newgem/README.md.tt (Development): Use the
test_task value to get the correct test task name ("test", not "test-unit").
* bundler/spec/commands/newgem_spec.rb (README.md): Add tests for test task
names for each test frameworks.

https://github.com/rubygems/rubygems/commit/2a24708a63
This commit is contained in:
gemmaro 2024-11-25 22:40:23 +09:00 committed by git
parent e1de5a6e3b
commit 1d510a952d
2 changed files with 17 additions and 1 deletions

View File

@ -26,7 +26,7 @@ TODO: Write usage instructions here
## Development
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test_task] %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
<% if config[:git] -%>

View File

@ -428,6 +428,22 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/README.md").read).not_to include("github.com/bundleuser")
end
end
describe "test task name on readme" do
shared_examples_for "test task name on readme" do |framework, task_name|
before do
bundle "gem #{gem_name} --test=#{framework}"
end
it "renders with correct name" do
expect(bundled_app("#{gem_name}/README.md").read).to include("Then, run `rake #{task_name}` to run the tests.")
end
end
it_behaves_like "test task name on readme", "test-unit", "test"
it_behaves_like "test task name on readme", "minitest", "test"
it_behaves_like "test task name on readme", "rspec", "spec"
end
end
it "creates a new git repository" do