Skip to content

Commit

Permalink
Add spec to class name definition in newgem spec
Browse files Browse the repository at this point in the history
  • Loading branch information
unasuke committed Jan 14, 2022
1 parent c795e5d commit 5f698fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bundler/spec/commands/newgem_spec.rb
Expand Up @@ -30,6 +30,8 @@ def bundle_exec_standardrb

let(:minitest_test_file_path) { "test/test_mygem.rb" }

let(:minitest_test_class_name) { "class TestMygem < Minitest::Test" }

before do
sys_exec("git config --global user.name 'Bundler User'")
sys_exec("git config --global user.email user@example.com")
Expand Down Expand Up @@ -736,6 +738,10 @@ def create_temporary_dir(dir)
expect(bundled_app("#{gem_name}/#{minitest_test_file_path}").read).to include(%(require "test_helper"))
end

it "defines valid test class name" do
expect(bundled_app("#{gem_name}/#{minitest_test_file_path}").read).to include(minitest_test_class_name)
end

it "creates a default test which fails" do
expect(bundled_app("#{gem_name}/#{minitest_test_file_path}").read).to include("assert false")
end
Expand Down Expand Up @@ -1304,6 +1310,8 @@ def create_temporary_dir(dir)

let(:minitest_test_file_path) { "test/test_test_gem.rb" }

let(:minitest_test_class_name) { "class TestTestGem < Minitest::Test" }

let(:flags) { nil }

it "does not nest constants" do
Expand Down Expand Up @@ -1361,6 +1369,8 @@ def create_temporary_dir(dir)

let(:minitest_test_file_path) { "test/test/test_gem.rb" }

let(:minitest_test_class_name) { "class TestTestGem < Minitest::Test" }

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/)
Expand Down

0 comments on commit 5f698fc

Please sign in to comment.