diff options
author | Yusuke Nakamura <yusuke1994525@gmail.com> | 2022-01-13 02:10:34 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-01-20 01:04:52 +0900 |
commit | 44513132521d8c2653ba3250d94628bfa9c1f0ff (patch) | |
tree | ba90101ba666bc728ae5c03f55ab4eeaffc526bc /spec/bundler | |
parent | 4e955b2e379a550cebd27e5d66fd5bcd98c70cf7 (diff) | |
download | ruby-44513132521d8c2653ba3250d94628bfa9c1f0ff.tar.gz |
[rubygems/rubygems] Update generated minitest file style
foo => test/test_foo.rb
foo-bar => test/foo/test_bar.rb
foo_bar => test/test_foo_bar.rb
https://github.com/rubygems/rubygems/commit/c795e5d40d
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 45bd3d5d4e..a41a0de508 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -28,6 +28,8 @@ RSpec.describe "bundle gem" do let(:require_path) { "mygem" } + let(:minitest_test_file_path) { "test/test_mygem.rb" } + before do sys_exec("git config --global user.name 'Bundler User'") sys_exec("git config --global user.email user@example.com") @@ -696,22 +698,18 @@ RSpec.describe "bundle gem" do end context "gem.test setting set to rspec and --test is set to minitest" do - let(:underscored_require_path) { require_path.tr("/", "_") } - before do bundle "config set gem.test rspec" bundle "gem #{gem_name} --test=minitest" end it "builds spec skeleton" do - expect(bundled_app("#{gem_name}/test/test_#{underscored_require_path}.rb")).to exist + expect(bundled_app("#{gem_name}/#{minitest_test_file_path}")).to exist expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist end end context "--test parameter set to minitest" do - let(:underscored_require_path) { require_path.tr("/", "_") } - before do bundle "gem #{gem_name} --test=minitest" end @@ -726,7 +724,7 @@ RSpec.describe "bundle gem" do end it "builds spec skeleton" do - expect(bundled_app("#{gem_name}/test/test_#{underscored_require_path}.rb")).to exist + expect(bundled_app("#{gem_name}/#{minitest_test_file_path}")).to exist expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist end @@ -735,11 +733,11 @@ RSpec.describe "bundle gem" do end it "requires 'test_helper'" do - expect(bundled_app("#{gem_name}/test/test_#{underscored_require_path}.rb").read).to include(%(require "test_helper")) + expect(bundled_app("#{gem_name}/#{minitest_test_file_path}").read).to include(%(require "test_helper")) end it "creates a default test which fails" do - expect(bundled_app("#{gem_name}/test/test_#{underscored_require_path}.rb").read).to include("assert false") + expect(bundled_app("#{gem_name}/#{minitest_test_file_path}").read).to include("assert false") end end @@ -1304,6 +1302,8 @@ RSpec.describe "bundle gem" do let(:require_relative_path) { "test_gem" } + let(:minitest_test_file_path) { "test/test_test_gem.rb" } + let(:flags) { nil } it "does not nest constants" do @@ -1359,6 +1359,8 @@ RSpec.describe "bundle gem" do let(:require_relative_path) { "gem" } + let(:minitest_test_file_path) { "test/test/test_gem.rb" } + it "nests constants so they work" do bundle "gem #{gem_name}" expect(bundled_app("#{gem_name}/lib/#{require_path}/version.rb").read).to match(/module Test\n module Gem/) |