From 8769caead60ead4e85b886d1c9c2b838438d5ba0 Mon Sep 17 00:00:00 2001 From: Piotr Kuczynski Date: Sat, 27 May 2023 00:31:43 +0200 Subject: [PATCH] Fix minitest deprecation warnings (#13) --- gem-empty.gemspec | 1 - test/gem-empty/command_test.rb | 34 +++++++++---------- .../specification_and_version_test.rb | 11 +++--- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/gem-empty.gemspec b/gem-empty.gemspec index 2aa1974..b46098b 100644 --- a/gem-empty.gemspec +++ b/gem-empty.gemspec @@ -15,5 +15,4 @@ Gem::Specification.new do |s| s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.add_development_dependency("rake") s.add_development_dependency("minitest") - # s.add_development_dependency("smf-gem") end diff --git a/test/gem-empty/command_test.rb b/test/gem-empty/command_test.rb index 8f9bcc5..c4984f6 100644 --- a/test/gem-empty/command_test.rb +++ b/test/gem-empty/command_test.rb @@ -18,11 +18,11 @@ def self.remove_spec spec end it "has some strings" do - subject.arguments.class.must_equal(String) - subject.usage.class.must_equal(String) - subject.defaults_str.class.must_equal(String) - subject.description.class.must_equal(String) - subject.program_name.class.must_equal(String) + _(subject.arguments.class).must_equal(String) + _(subject.usage.class).must_equal(String) + _(subject.defaults_str.class).must_equal(String) + _(subject.description.class).must_equal(String) + _(subject.program_name.class).must_equal(String) end describe "gem-empty" do @@ -50,24 +50,24 @@ def self.remove_spec spec end it "removes gems" do - File.exist?(File.join(@test_path, "gems", @found_minitest.full_name)).must_equal(true) + _(File.exist?(File.join(@test_path, "gems", @found_minitest.full_name))).must_equal(true) use_ui @ui do subject.execute(:install_dir => @test_path) end - File.exist?(File.join(@test_path, "gems", @found_minitest.full_name)).must_equal(false) - @ui.output.must_match( + _(File.exist?(File.join(@test_path, "gems", @found_minitest.full_name))).must_equal(false) + _(@ui.output).must_match( /Successfully uninstalled minitest-/ ) - @ui.error.must_equal("") + _(@ui.error).must_equal("") end it "removes git gems installed via bundler" do - File.exist?(@git_gem_file).must_equal(true) + _(File.exist?(@git_gem_file)).must_equal(true) use_ui @ui do subject.execute(:install_dir => @test_path) end - File.exist?(@git_gem_file).must_equal(false) - @ui.error.must_equal("") + _(File.exist?(@git_gem_file)).must_equal(false) + _(@ui.error).must_equal("") end it "fails gems" do @@ -75,10 +75,10 @@ def self.remove_spec spec use_ui @ui do subject.execute(:install_dir => @test_path) end - File.exist?(File.join(@test_path, "gems", @found_minitest.full_name)).must_equal(true) + _(File.exist?(File.join(@test_path, "gems", @found_minitest.full_name))).must_equal(true) File.chmod(0755, File.join(@test_path) ) - @ui.output.must_equal("") - @ui.error.must_match( + _(@ui.output).must_equal("") + _(@ui.error).must_match( /ERROR: Gem::FilePermissionError: You don't have write permissions for the .* directory/ ) end @@ -87,8 +87,8 @@ def self.remove_spec spec it "finds gem executables" do subject.stub :options, {:install_dir => Gem.dir } do - subject.send(:gem_dir_specs).map{|spec| spec.name}.must_include('minitest') + _(subject.send(:gem_dir_specs).map{|spec| spec.name}).must_include('minitest') end end -end +end \ No newline at end of file diff --git a/test/gem-empty/specification_and_version_test.rb b/test/gem-empty/specification_and_version_test.rb index 964082c..d7820e1 100644 --- a/test/gem-empty/specification_and_version_test.rb +++ b/test/gem-empty/specification_and_version_test.rb @@ -9,19 +9,18 @@ end it "finds specification" do - GemEmpty::Specification.find_gem_spec("gem-empty").name.must_equal("gem-empty") + _(GemEmpty::Specification.find_gem_spec("gem-empty").name).must_equal("gem-empty") end it "does not find imaginary gems" do - GemEmpty::Specification.find_gem_spec("imaginary-gem").must_equal(nil) + _(GemEmpty::Specification.find_gem_spec("imaginary-gem")).must_be_nil end it "confirms specification version" do - GemEmpty::Specification.gem_loaded?("gem-empty", GemEmpty::VERSION).must_equal true + _(GemEmpty::Specification.gem_loaded?("gem-empty", GemEmpty::VERSION)).must_equal true end it "does not confirms specification version" do - GemEmpty::Specification.gem_loaded?("gem-empty", "0.0.0").wont_equal true + _(GemEmpty::Specification.gem_loaded?("gem-empty", "0.0.0")).wont_equal true end - -end +end \ No newline at end of file