diff options
Diffstat (limited to 'test/rubygems/test_gem_commands_contents_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_contents_command.rb | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb index d79174717b..d8e6ba3dec 100644 --- a/test/rubygems/test_gem_commands_contents_command.rb +++ b/test/rubygems/test_gem_commands_contents_command.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true -require_relative 'helper' -require 'rubygems/commands/contents_command' + +require_relative "helper" +require "rubygems/commands/contents_command" class TestGemCommandsContentsCommand < Gem::TestCase def setup @@ -20,22 +21,22 @@ class TestGemCommandsContentsCommand < Gem::TestCase def test_execute @cmd.options[:args] = %w[foo] - gem 'foo' + gem "foo" use_ui @ui do @cmd.execute end assert_match %r{lib/foo\.rb}, @ui.output - assert_match %r{Rakefile}, @ui.output + assert_match(/Rakefile/, @ui.output) assert_equal "", @ui.error end def test_execute_all @cmd.options[:all] = true - gem 'foo' - gem 'bar' + gem "foo" + gem "bar" use_ui @ui do @cmd.execute @@ -43,7 +44,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase assert_match %r{lib/foo\.rb}, @ui.output assert_match %r{lib/bar\.rb}, @ui.output - assert_match %r{Rakefile}, @ui.output + assert_match(/Rakefile/, @ui.output) assert_equal "", @ui.error end @@ -56,22 +57,22 @@ class TestGemCommandsContentsCommand < Gem::TestCase end end - assert_match %r{Unable to find gem 'foo' in default gem paths}, @ui.output - assert_match %r{Directories searched:}, @ui.output + assert_match(/Unable to find gem 'foo' in default gem paths/, @ui.output) + assert_match(/Directories searched:/, @ui.output) assert_equal "", @ui.error end def test_execute_exact_match @cmd.options[:args] = %w[foo] - gem 'foo' - gem 'bar' + gem "foo" + gem "bar" use_ui @ui do @cmd.execute end assert_match %r{lib/foo\.rb}, @ui.output - assert_match %r{Rakefile}, @ui.output + assert_match(/Rakefile/, @ui.output) assert_equal "", @ui.error end @@ -79,14 +80,14 @@ class TestGemCommandsContentsCommand < Gem::TestCase @cmd.options[:args] = %w[foo] @cmd.options[:lib_only] = true - gem 'foo' + gem "foo" use_ui @ui do @cmd.execute end assert_match %r{lib/foo\.rb}, @ui.output - refute_match %r{Rakefile}, @ui.output + refute_match(/Rakefile/, @ui.output) assert_equal "", @ui.error end @@ -106,9 +107,9 @@ class TestGemCommandsContentsCommand < Gem::TestCase def test_execute_missing_version @cmd.options[:args] = %w[foo] - @cmd.options[:version] = Gem::Requirement.new '= 2' + @cmd.options[:version] = Gem::Requirement.new "= 2" - gem 'foo', 1 + gem "foo", 1 assert_raise Gem::MockGemUi::TermError do use_ui @ui do @@ -123,7 +124,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase def test_execute_missing_multiple @cmd.options[:args] = %w[foo bar] - gem 'foo' + gem "foo" use_ui @ui do @cmd.execute @@ -138,8 +139,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase def test_execute_multiple @cmd.options[:args] = %w[foo bar] - gem 'foo' - gem 'bar' + gem "foo" + gem "bar" use_ui @ui do @cmd.execute @@ -147,7 +148,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase assert_match %r{lib/foo\.rb}, @ui.output assert_match %r{lib/bar\.rb}, @ui.output - assert_match %r{Rakefile}, @ui.output + assert_match(/Rakefile/, @ui.output) assert_equal "", @ui.error end @@ -155,13 +156,13 @@ class TestGemCommandsContentsCommand < Gem::TestCase @cmd.options[:args] = %w[foo] @cmd.options[:show_install_dir] = true - gem 'foo' + gem "foo" use_ui @ui do @cmd.execute end - expected = File.join @gemhome, 'gems', 'foo-2' + expected = File.join @gemhome, "gems", "foo-2" assert_equal "#{expected}\n", @ui.output assert_equal "", @ui.error @@ -171,14 +172,14 @@ class TestGemCommandsContentsCommand < Gem::TestCase @cmd.options[:args] = %w[foo] @cmd.options[:show_install_dir] = true - gem 'foo', 1 - gem 'foo', 2 + gem "foo", 1 + gem "foo", 2 use_ui @ui do @cmd.execute end - expected = File.join @gemhome, 'gems', 'foo-2' + expected = File.join @gemhome, "gems", "foo-2" assert_equal "#{expected}\n", @ui.output assert_equal "", @ui.error @@ -187,16 +188,16 @@ class TestGemCommandsContentsCommand < Gem::TestCase def test_execute_show_install_dir_version @cmd.options[:args] = %w[foo] @cmd.options[:show_install_dir] = true - @cmd.options[:version] = Gem::Requirement.new '= 1' + @cmd.options[:version] = Gem::Requirement.new "= 1" - gem 'foo', 1 - gem 'foo', 2 + gem "foo", 1 + gem "foo", 2 use_ui @ui do @cmd.execute end - expected = File.join @gemhome, 'gems', 'foo-1' + expected = File.join @gemhome, "gems", "foo-1" assert_equal "#{expected}\n", @ui.output assert_equal "", @ui.error @@ -206,7 +207,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase @cmd.options[:args] = %w[foo] @cmd.options[:prefix] = false - gem 'foo' + gem "foo" use_ui @ui do @cmd.execute @@ -236,10 +237,10 @@ lib/foo.rb end expected = [ - [RbConfig::CONFIG['bindir'], 'default_command'], - [RbConfig::CONFIG['rubylibdir'], 'default/gem.rb'], - [RbConfig::CONFIG['archdir'], 'default_gem.so'], - ].sort.map{|a|File.join a }.join "\n" + [RbConfig::CONFIG["bindir"], "default_command"], + [RbConfig::CONFIG["rubylibdir"], "default/gem.rb"], + [RbConfig::CONFIG["archdir"], "default_gem.so"], + ].sort.map {|a|File.join a }.join "\n" assert_equal expected, @ui.output.chomp assert_equal "", @ui.error @@ -264,7 +265,7 @@ lib/foo.rb assert @cmd.options[:lib_only] refute @cmd.options[:prefix] assert_equal %w[foo], @cmd.options[:specdirs] - assert_equal Gem::Requirement.new('0.0.2'), @cmd.options[:version] + assert_equal Gem::Requirement.new("0.0.2"), @cmd.options[:version] assert @cmd.options[:show_install_dir] end end |