summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTangRufus <[email protected]>2025-05-30 02:35:19 +0100
committerHiroshi SHIBATA <[email protected]>2025-06-03 08:04:39 +0900
commit6b2088cf9037663170b20fff5de90d35c47fce3f (patch)
treec723a625c2a01b63c00d859492136e0d928992b3
parenta7be563d0b964aa1294c6a55fd8f43233baaf101 (diff)
[rubygems/rubygems] Exclude `.rspec` from `spec.files` in the `.gemspec` template
https://github.com/rubygems/rubygems/commit/331901941d
-rw-r--r--lib/bundler/cli/gem.rb1
-rw-r--r--spec/bundler/commands/newgem_spec.rb20
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 749b3012d1..2bb1fee467 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -109,6 +109,7 @@ module Bundler
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
)
config[:test_task] = :spec
+ config[:ignore_files] << ".rspec"
when "minitest"
# Generate path for minitest target file (FileList["test/**/test_*.rb"])
# foo => test/test_foo.rb
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 10fe0bec52..75556d7e42 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -441,6 +441,11 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/test/#{require_path}.rb")).to_not exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to_not exist
end
+
+ it "does not add .rspec into ignore list" do
+ refute_ignore_list_includes ".rspec"
+ refute_ignore_list_includes "spec/"
+ end
end
context "README.md" do
@@ -781,6 +786,11 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
end
+ it "includes .rspec and spec/ into ignore list" do
+ assert_ignore_list_includes ".rspec"
+ assert_ignore_list_includes "spec/"
+ end
+
it "depends on a specific version of rspec in generated Gemfile" do
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
builder = Bundler::Dsl.new
@@ -834,6 +844,11 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/spec/#{require_path}_spec.rb")).to exist
expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
end
+
+ it "includes .rspec and spec/ into ignore list" do
+ assert_ignore_list_includes ".rspec"
+ assert_ignore_list_includes "spec/"
+ end
end
context "gem.test setting set to rspec and --test is set to minitest" do
@@ -987,6 +1002,11 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
end
+ it "includes .rspec and spec/ into ignore list" do
+ assert_ignore_list_includes ".rspec"
+ assert_ignore_list_includes "spec/"
+ end
+
it "hints that --test is already configured" do
expect(out).to match("rspec is already configured, ignoring --test flag.")
end