summaryrefslogtreecommitdiff
path: root/spec/bundler/commands/newgem_spec.rb
diff options
context:
space:
mode:
authorFrank Lam <ryzingsun11@yahoo.com>2020-05-23 01:00:00 +0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-05 07:32:42 +0900
commit154c2717da6bb59f1b2739777b01cea98b667751 (patch)
tree005436cacb33c113ac80ab51554ef4d8dcf509f4 /spec/bundler/commands/newgem_spec.rb
parent58267fa59e6ea2e4e90a7459a5d7d2f0f57d4f02 (diff)
[rubygems/rubygems] Add user hint specs for bundle gem --test
https://github.com/rubygems/rubygems/commit/1d2292a88f
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3184
Diffstat (limited to 'spec/bundler/commands/newgem_spec.rb')
-rw-r--r--spec/bundler/commands/newgem_spec.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index fcefa4d15e..4b7a88bddd 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -623,18 +623,32 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
end
+ it "hints that --test is not needed" do
+ hint = "Bundler is configured to generate test files for rspec, "\
+ "so -t is not needed if you want to continue using it. " \
+ "This setting can be changed anytime with `bundle config gem.test`."
+ expect(last_command.stdout).to match(hint)
+ end
+
it_behaves_like "test framework is present"
end
context "gem.test setting set to false and --test with no arguments" do
before do
bundle "config set gem.test false"
+ bundle! "gem #{gem_name} --test"
end
it "asks to generate test files" do
- result = bundle! "gem #{gem_name} --test"
- expect(result).to match("Do you want to generate tests with your gem?")
+ expect(last_command.stdout).to match("Do you want to generate tests with your gem?")
+ end
+
+ it "hints that the choice will only be applied to the current gem" do
+ hint = "Your choice will only be applied to this gem."
+ expect(last_command.stdout).to match(hint)
end
+
+ it_behaves_like "test framework is absent"
end
context "gem.test setting not set and --test with no arguments" do
@@ -642,6 +656,12 @@ RSpec.describe "bundle gem" do
bundle! "gem #{gem_name} --test"
end
+ it "hints that the choice will be applied to future bundle gem calls" do
+ hint = "Future `bundle gem` calls will use your choice. " \
+ "This setting can be changed anytime with `bundle config gem.test`."
+ expect(last_command.stdout).to match(hint)
+ end
+
it_behaves_like "test framework is absent"
end