Skip to content

Commit 1d510a9

Browse files
gemmaromatzbot
authored andcommitted
[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. rubygems/rubygems@2a24708a63
1 parent e1de5a6 commit 1d510a9

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/bundler/templates/newgem/README.md.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TODO: Write usage instructions here
2626

2727
## Development
2828

29-
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 %>
29+
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 %>
3030

3131
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).
3232
<% if config[:git] -%>

spec/bundler/commands/newgem_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,22 @@ def bundle_exec_standardrb
428428
expect(bundled_app("#{gem_name}/README.md").read).not_to include("github.com/bundleuser")
429429
end
430430
end
431+
432+
describe "test task name on readme" do
433+
shared_examples_for "test task name on readme" do |framework, task_name|
434+
before do
435+
bundle "gem #{gem_name} --test=#{framework}"
436+
end
437+
438+
it "renders with correct name" do
439+
expect(bundled_app("#{gem_name}/README.md").read).to include("Then, run `rake #{task_name}` to run the tests.")
440+
end
441+
end
442+
443+
it_behaves_like "test task name on readme", "test-unit", "test"
444+
it_behaves_like "test task name on readme", "minitest", "test"
445+
it_behaves_like "test task name on readme", "rspec", "spec"
446+
end
431447
end
432448

433449
it "creates a new git repository" do

0 commit comments

Comments
 (0)