Skip to content

Commit

Permalink
Fix minitest deprecation warnings #10
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuczynski committed May 26, 2023
2 parents 25b590b + efa918e commit b446e04
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
34 changes: 17 additions & 17 deletions test/gem-empty/command_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -50,35 +50,35 @@ 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
File.chmod(0500, File.join(@test_path) )
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
Expand All @@ -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
11 changes: 5 additions & 6 deletions test/gem-empty/specification_and_version_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b446e04

Please sign in to comment.