summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFrank Lam <ryzingsun11@yahoo.com>2020-05-30 17:06:57 +0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-18 19:14:15 +0900
commit8e3136a03bdaf1aa405a07e689206080f3dfed7b (patch)
treebda8693a301b2924c8f1f2c92295650cb2b2ef8a /spec
parenta80a5706b1d6737b866a164ad672a80de669dec1 (diff)
[rubygems/rubygems] Make test framework/CI configuration for bundle gem consistent
* Add hints for --ci option https://github.com/rubygems/rubygems/commit/5f779f45b0
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3212
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/newgem_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index d78bc8a723..67166b3ab7 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -739,6 +739,55 @@ RSpec.describe "bundle gem" do
end
end
+ context "gem.ci set to github and --ci with no arguments", :hint_text do
+ before do
+ bundle "config set gem.ci github"
+ bundle! "gem #{gem_name} --ci"
+ end
+
+ it "generates a GitHub Actions config file" do
+ expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to exist
+ end
+
+ it "hints that --ci is not needed" do
+ hint = "Bundler is configured to generate CI files for github, "\
+ "so --ci is not needed if you want to continue using it. " \
+ "This setting can be changed anytime with `bundle config gem.ci`."
+ expect(out).to match(hint)
+ end
+ end
+
+ context "gem.ci setting set to false and --ci with no arguments", :hint_text do
+ before do
+ bundle "config set gem.ci false"
+ bundle! "gem #{gem_name} --ci"
+ end
+
+ it "asks to setup CI" do
+ expect(out).to match("Do you want to set up automated testing for your gem?")
+ end
+
+ it "hints that the choice will only be applied to the current gem" do
+ expect(out).to match("Your choice will only be applied to this gem.")
+ end
+ end
+
+ context "gem.ci setting not set and --ci with no arguments", :hint_text do
+ before do
+ bundle! "gem #{gem_name} --ci"
+ end
+
+ it "asks to setup CI" do
+ expect(out).to match("Do you want to set up automated testing for your gem?")
+ 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.ci`."
+ expect(out).to match(hint)
+ end
+ end
+
context "--edit option" do
it "opens the generated gemspec in the user's text editor" do
output = bundle "gem #{gem_name} --edit=echo"