summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFrank Lam <ryzingsun11@yahoo.com>2020-05-28 15:37:05 +0800
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-18 19:14:15 +0900
commite6479ac3f69ff1d27646ba9e44a829c3d00a1374 (patch)
tree4eb0190df741adb5b5415139b68298f60d7af62d /spec
parent0d3c185b59e38eeb92c32a49b0a8c5c57c337054 (diff)
[rubygems/rubygems] Move CI specs below test framework specs
https://github.com/rubygems/rubygems/commit/d8e416d89b
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3212
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/newgem_spec.rb158
1 files changed, 79 insertions, 79 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 100effa6ee..cd6f308810 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -572,6 +572,85 @@ RSpec.describe "bundle gem" do
end
end
+ context "gem.test setting set to test-unit" do
+ before do
+ bundle "config set gem.test test-unit"
+ bundle "gem #{gem_name}"
+ end
+
+ it "creates a default rake task to run the test suite" do
+ rakefile = strip_whitespace <<-RAKEFILE
+ require "bundler/gem_tasks"
+ require "rake/testtask"
+
+ Rake::TestTask.new(:test) do |t|
+ t.libs << "test"
+ t.libs << "lib"
+ t.test_files = FileList["test/**/*_test.rb"]
+ end
+
+ task :default => :test
+ RAKEFILE
+
+ expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
+ end
+ end
+
+ context "gem.test set to rspec and --test with no arguments", :hint_text do
+ before do
+ bundle "config set gem.test rspec"
+ bundle! "gem #{gem_name} --test"
+ end
+
+ it "builds spec skeleton" do
+ expect(bundled_app("#{gem_name}/.rspec")).to exist
+ 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 "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(out).to match(hint)
+ end
+ end
+
+ context "gem.test setting set to false and --test with no arguments", :hint_text do
+ before do
+ bundle "config set gem.test false"
+ bundle! "gem #{gem_name} --test"
+ end
+
+ it "asks to generate test files" do
+ expect(out).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
+ expect(out).to match("Your choice will only be applied to this gem.")
+ end
+
+ it_behaves_like "test framework is absent"
+ end
+
+ context "gem.test setting not set and --test with no arguments", :hint_text do
+ before do
+ bundle! "gem #{gem_name} --test"
+ end
+
+ it "asks to generate test files" do
+ expect(out).to match("Do you want to generate tests with 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.test`."
+ expect(out).to match(hint)
+ end
+
+ it_behaves_like "test framework is absent"
+ end
+
context "--ci with no arugment" do
it "does not generate any CI config" do
bundle "gem #{gem_name}"
@@ -660,85 +739,6 @@ RSpec.describe "bundle gem" do
end
end
- context "gem.test setting set to test-unit" do
- before do
- bundle "config set gem.test test-unit"
- bundle "gem #{gem_name}"
- end
-
- it "creates a default rake task to run the test suite" do
- rakefile = strip_whitespace <<-RAKEFILE
- require "bundler/gem_tasks"
- require "rake/testtask"
-
- Rake::TestTask.new(:test) do |t|
- t.libs << "test"
- t.libs << "lib"
- t.test_files = FileList["test/**/*_test.rb"]
- end
-
- task :default => :test
- RAKEFILE
-
- expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
- end
- end
-
- context "gem.test set to rspec and --test with no arguments", :hint_text do
- before do
- bundle "config set gem.test rspec"
- bundle! "gem #{gem_name} --test"
- end
-
- it "builds spec skeleton" do
- expect(bundled_app("#{gem_name}/.rspec")).to exist
- 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 "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(out).to match(hint)
- end
- end
-
- context "gem.test setting set to false and --test with no arguments", :hint_text do
- before do
- bundle "config set gem.test false"
- bundle! "gem #{gem_name} --test"
- end
-
- it "asks to generate test files" do
- expect(out).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
- expect(out).to match("Your choice will only be applied to this gem.")
- end
-
- it_behaves_like "test framework is absent"
- end
-
- context "gem.test setting not set and --test with no arguments", :hint_text do
- before do
- bundle! "gem #{gem_name} --test"
- end
-
- it "asks to generate test files" do
- expect(out).to match("Do you want to generate tests with 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.test`."
- expect(out).to match(hint)
- end
-
- it_behaves_like "test framework is absent"
- end
-
context "--edit option" do
it "opens the generated gemspec in the user's text editor" do
output = bundle "gem #{gem_name} --edit=echo"