summaryrefslogtreecommitdiff
path: root/spec/bundler/commands/newgem_spec.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-07-24 12:24:55 +0200
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-08-16 14:30:23 +0900
commitb587e8c7f1cd56f1c53156d7893ee0e581128a0a (patch)
tree57abd1230e6f723e0dc938718ca9ded360786d55 /spec/bundler/commands/newgem_spec.rb
parentcb71930351f8978d3c0b06acc14c98a8978f3abe (diff)
[bundler/bundler] Add `--[no-]git` option to `bundle gem`
I think using `--no-git` can be useful when creating gems inside monorepos. https://github.com/bundler/bundler/commit/154c687310
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2366
Diffstat (limited to 'spec/bundler/commands/newgem_spec.rb')
-rw-r--r--spec/bundler/commands/newgem_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 7b05bf3ed0..f4cd29edbc 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -60,6 +60,42 @@ RSpec.describe "bundle gem" do
end
end
+ describe "git repo initialization" do
+ let(:gem_name) { "test-gem" }
+
+ shared_examples_for "a gem with an initial git repo" do
+ before do
+ execute_bundle_gem(gem_name, flags)
+ end
+ it "generates a gem skeleton with a .git folder" do
+ gem_skeleton_assertions(gem_name)
+ expect(bundled_app("test-gem/.git")).to exist
+ end
+ end
+
+ context "when using the default" do
+ it_behaves_like "a gem with an initial git repo" do
+ let(:flags) { "" }
+ end
+ end
+
+ context "when explicitly passing --git" do
+ it_behaves_like "a gem with an initial git repo" do
+ let(:flags) { "--git" }
+ end
+ end
+
+ context "when passing --no-git" do
+ before do
+ execute_bundle_gem(gem_name, "--no-git")
+ end
+ it "generates a gem skeleton without a .git folder" do
+ gem_skeleton_assertions(gem_name)
+ expect(bundled_app("test-gem/.git")).not_to exist
+ end
+ end
+ end
+
shared_examples_for "--mit flag" do
before do
execute_bundle_gem(gem_name, "--mit")