mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
RubyGems: Enable Style/StringLiterals cop
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
This commit is contained in:
parent
388c4e1076
commit
d7ffd3fea4
288 changed files with 7275 additions and 7275 deletions
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative 'helper'
|
||||
require 'rubygems/commands/sources_command'
|
||||
require_relative "helper"
|
||||
require "rubygems/commands/sources_command"
|
||||
|
||||
class TestGemCommandsSourcesCommand < Gem::TestCase
|
||||
def setup
|
||||
|
@ -20,7 +20,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_proxy
|
||||
assert @cmd.handles?(['--http-proxy', 'http://proxy.example.com'])
|
||||
assert @cmd.handles?(["--http-proxy", "http://proxy.example.com"])
|
||||
end
|
||||
|
||||
def test_execute
|
||||
|
@ -37,12 +37,12 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_add
|
||||
spec_fetcher do |fetcher|
|
||||
fetcher.spec 'a', 1
|
||||
fetcher.spec "a", 1
|
||||
end
|
||||
|
||||
specs = Gem::Specification.map do |spec|
|
||||
|
@ -70,7 +70,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_add_allow_typo_squatting_source
|
||||
|
@ -181,7 +181,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
|
|||
|
||||
uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz"
|
||||
@fetcher.data[uri] = proc do
|
||||
raise Gem::RemoteFetcher::FetchError.new('it died', uri)
|
||||
raise Gem::RemoteFetcher::FetchError.new("it died", uri)
|
||||
end
|
||||
|
||||
@cmd.handle_options %w[--add http://beta-gems.example.com]
|
||||
|
@ -198,7 +198,7 @@ Error fetching http://beta-gems.example.com:
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_add_existent_source_invalid_uri
|
||||
|
@ -208,7 +208,7 @@ Error fetching http://beta-gems.example.com:
|
|||
|
||||
@cmd.handle_options %w[--add https://u:p@example.com]
|
||||
@fetcher.data[uri] = proc do
|
||||
raise Gem::RemoteFetcher::FetchError.new('it died', uri)
|
||||
raise Gem::RemoteFetcher::FetchError.new("it died", uri)
|
||||
end
|
||||
|
||||
use_ui @ui do
|
||||
|
@ -223,7 +223,7 @@ Error fetching https://u:REDACTED@example.com:
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_add_existent_source_invalid_uri_with_error_by_chance_including_the_uri_password
|
||||
|
@ -233,7 +233,7 @@ Error fetching https://u:REDACTED@example.com:
|
|||
|
||||
@cmd.handle_options %w[--add https://u:secret@example.com]
|
||||
@fetcher.data[uri] = proc do
|
||||
raise Gem::RemoteFetcher::FetchError.new('it secretly died', uri)
|
||||
raise Gem::RemoteFetcher::FetchError.new("it secretly died", uri)
|
||||
end
|
||||
|
||||
use_ui @ui do
|
||||
|
@ -248,7 +248,7 @@ Error fetching https://u:REDACTED@example.com:
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_add_redundant_source
|
||||
|
@ -267,7 +267,7 @@ source #{@gem_repo} already present in the cache
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_add_redundant_source_trailing_slash
|
||||
|
@ -287,7 +287,7 @@ source #{@gem_repo} already present in the cache
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
|
||||
# Re-add pre-existing gem source (w/o slash)
|
||||
repo_without_slash = "http://gems.example.com"
|
||||
|
@ -304,7 +304,7 @@ http://gems.example.com added to sources
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
|
||||
# Re-add original gem source (w/ slash)
|
||||
@cmd.handle_options %W[--add #{repo_with_slash}]
|
||||
|
@ -321,14 +321,14 @@ source http://gems.example.com/ already present in the cache
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_add_http_rubygems_org
|
||||
http_rubygems_org = 'http://rubygems.org/'
|
||||
http_rubygems_org = "http://rubygems.org/"
|
||||
|
||||
spec_fetcher do |fetcher|
|
||||
fetcher.spec 'a', 1
|
||||
fetcher.spec "a", 1
|
||||
end
|
||||
|
||||
specs = Gem::Specification.map do |spec|
|
||||
|
@ -393,10 +393,10 @@ source http://gems.example.com/ already present in the cache
|
|||
end
|
||||
|
||||
def test_execute_add_https_rubygems_org
|
||||
https_rubygems_org = 'https://rubygems.org/'
|
||||
https_rubygems_org = "https://rubygems.org/"
|
||||
|
||||
spec_fetcher do |fetcher|
|
||||
fetcher.spec 'a', 1
|
||||
fetcher.spec "a", 1
|
||||
end
|
||||
|
||||
specs = Gem::Specification.map do |spec|
|
||||
|
@ -446,7 +446,7 @@ beta-gems.example.com is not a URI
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_clear_all
|
||||
|
@ -461,10 +461,10 @@ beta-gems.example.com is not a URI
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
|
||||
dir = Gem.spec_cache_dir
|
||||
refute File.exist?(dir), 'cache dir removed'
|
||||
refute File.exist?(dir), "cache dir removed"
|
||||
end
|
||||
|
||||
def test_execute_list
|
||||
|
@ -481,7 +481,7 @@ beta-gems.example.com is not a URI
|
|||
EOF
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_remove
|
||||
|
@ -494,7 +494,7 @@ beta-gems.example.com is not a URI
|
|||
expected = "#{@gem_repo} removed from sources\n"
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_remove_no_network
|
||||
|
@ -513,14 +513,14 @@ beta-gems.example.com is not a URI
|
|||
expected = "#{@gem_repo} removed from sources\n"
|
||||
|
||||
assert_equal expected, @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
|
||||
def test_execute_update
|
||||
@cmd.handle_options %w[--update]
|
||||
|
||||
spec_fetcher do |fetcher|
|
||||
fetcher.gem 'a', 1
|
||||
fetcher.gem "a", 1
|
||||
end
|
||||
|
||||
use_ui @ui do
|
||||
|
@ -528,6 +528,6 @@ beta-gems.example.com is not a URI
|
|||
end
|
||||
|
||||
assert_equal "source cache successfully updated\n", @ui.output
|
||||
assert_equal '', @ui.error
|
||||
assert_equal "", @ui.error
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue