summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_source_git.rb
diff options
context:
space:
mode:
authorTakuya Noguchi <[email protected]>2022-07-17 08:08:51 +0000
committerHiroshi SHIBATA <[email protected]>2022-07-22 12:07:23 +0900
commitd7ffd3fea402239b16833cc434404a7af82d44f3 (patch)
tree9794942135111c36e6b6bce69e070ca556b89028 /test/rubygems/test_gem_source_git.rb
parent388c4e1076ac5a58d5008abc8e0a8d017698875a (diff)
RubyGems: Enable Style/StringLiterals cop
Signed-off-by: Takuya Noguchi <[email protected]>
Diffstat (limited to 'test/rubygems/test_gem_source_git.rb')
-rw-r--r--test/rubygems/test_gem_source_git.rb118
1 files changed, 59 insertions, 59 deletions
diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb
index b97556d61d..5702da0597 100644
--- a/test/rubygems/test_gem_source_git.rb
+++ b/test/rubygems/test_gem_source_git.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require_relative 'helper'
-require 'rubygems/source'
+require_relative "helper"
+require "rubygems/source"
class TestGemSourceGit < Gem::TestCase
def setup
@@ -10,36 +10,36 @@ class TestGemSourceGit < Gem::TestCase
@hash = Digest::SHA1.hexdigest @repository
- @source = Gem::Source::Git.new @name, @repository, 'master', false
+ @source = Gem::Source::Git.new @name, @repository, "master", false
end
def test_base_dir
- assert_equal File.join(Gem.dir, 'bundler'), @source.base_dir
+ assert_equal File.join(Gem.dir, "bundler"), @source.base_dir
@source.root_dir = "#{@gemhome}2"
- assert_equal File.join("#{@gemhome}2", 'bundler'), @source.base_dir
+ assert_equal File.join("#{@gemhome}2", "bundler"), @source.base_dir
end
def test_checkout
@source.checkout
- assert_path_exist File.join @source.install_dir, 'a.gemspec'
+ assert_path_exist File.join @source.install_dir, "a.gemspec"
end
def test_checkout_master
Dir.chdir @repository do
- system @git, 'checkout', '-q', '-b', 'other'
- system @git, 'mv', 'a.gemspec', 'b.gemspec'
- system @git, 'commit', '-q', '-a', '-m', 'rename gemspec'
- system @git, 'checkout', '-q', 'master'
+ system @git, "checkout", "-q", "-b", "other"
+ system @git, "mv", "a.gemspec", "b.gemspec"
+ system @git, "commit", "-q", "-a", "-m", "rename gemspec"
+ system @git, "checkout", "-q", "master"
end
- @source = Gem::Source::Git.new @name, @repository, 'other', false
+ @source = Gem::Source::Git.new @name, @repository, "other", false
@source.checkout
- assert_path_exist File.join @source.install_dir, 'b.gemspec'
+ assert_path_exist File.join @source.install_dir, "b.gemspec"
end
def test_checkout_local
@@ -47,9 +47,9 @@ class TestGemSourceGit < Gem::TestCase
@source.checkout
- install_dir = File.join Gem.dir, 'bundler', 'gems', "a-#{@head[0..11]}"
+ install_dir = File.join Gem.dir, "bundler", "gems", "a-#{@head[0..11]}"
- assert_path_not_exist File.join install_dir, 'a.gemspec'
+ assert_path_not_exist File.join install_dir, "a.gemspec"
end
def test_checkout_local_cached
@@ -59,26 +59,26 @@ class TestGemSourceGit < Gem::TestCase
@source.checkout
- assert_path_exist File.join @source.install_dir, 'a.gemspec'
+ assert_path_exist File.join @source.install_dir, "a.gemspec"
end
def test_checkout_submodules
- source = Gem::Source::Git.new @name, @repository, 'master', true
+ source = Gem::Source::Git.new @name, @repository, "master", true
- git_gem 'b'
+ git_gem "b"
- Dir.chdir 'git/a' do
+ Dir.chdir "git/a" do
require "open3"
- output, status = Open3.capture2e(@git, 'submodule', '--quiet', 'add', File.expand_path('../b'), 'b')
+ output, status = Open3.capture2e(@git, "submodule", "--quiet", "add", File.expand_path("../b"), "b")
assert status.success?, output
- system @git, 'commit', '--quiet', '-m', 'add submodule b'
+ system @git, "commit", "--quiet", "-m", "add submodule b"
end
source.checkout
- assert_path_exist File.join source.install_dir, 'a.gemspec'
- assert_path_exist File.join source.install_dir, 'b/b.gemspec'
+ assert_path_exist File.join source.install_dir, "a.gemspec"
+ assert_path_exist File.join source.install_dir, "b/b.gemspec"
end
def test_cache
@@ -87,7 +87,7 @@ class TestGemSourceGit < Gem::TestCase
assert_path_exist @source.repo_cache_dir
Dir.chdir @source.repo_cache_dir do
- assert_equal @head, Gem::Util.popen(@git, 'rev-parse', 'master').strip
+ assert_equal @head, Gem::Util.popen(@git, "rev-parse", "master").strip
end
end
@@ -115,17 +115,17 @@ class TestGemSourceGit < Gem::TestCase
assert_equal @source, @source.dup
source =
- Gem::Source::Git.new @source.name, @source.repository, 'other', false
+ Gem::Source::Git.new @source.name, @source.repository, "other", false
refute_equal @source, source
source =
- Gem::Source::Git.new @source.name, 'repo/other', @source.reference, false
+ Gem::Source::Git.new @source.name, "repo/other", @source.reference, false
refute_equal @source, source
source =
- Gem::Source::Git.new 'b', @source.repository, @source.reference, false
+ Gem::Source::Git.new "b", @source.repository, @source.reference, false
refute_equal @source, source
@@ -139,7 +139,7 @@ class TestGemSourceGit < Gem::TestCase
def test_install_dir
@source.cache
- expected = File.join Gem.dir, 'bundler', 'gems', "a-#{@head[0..11]}"
+ expected = File.join Gem.dir, "bundler", "gems", "a-#{@head[0..11]}"
assert_equal expected, @source.install_dir
end
@@ -152,14 +152,14 @@ class TestGemSourceGit < Gem::TestCase
def test_repo_cache_dir
expected =
- File.join Gem.dir, 'cache', 'bundler', 'git', "a-#{@hash}"
+ File.join Gem.dir, "cache", "bundler", "git", "a-#{@hash}"
assert_equal expected, @source.repo_cache_dir
@source.root_dir = "#{@gemhome}2"
expected =
- File.join "#{@gemhome}2", 'cache', 'bundler', 'git', "a-#{@hash}"
+ File.join "#{@gemhome}2", "cache", "bundler", "git", "a-#{@hash}"
assert_equal expected, @source.repo_cache_dir
end
@@ -170,20 +170,20 @@ class TestGemSourceGit < Gem::TestCase
assert_equal @head, @source.rev_parse
Dir.chdir @repository do
- system @git, 'checkout', '--quiet', '-b', 'other'
+ system @git, "checkout", "--quiet", "-b", "other"
end
master_head = @head
- git_gem 'a', 2
+ git_gem "a", 2
- source = Gem::Source::Git.new @name, @repository, 'other', false
+ source = Gem::Source::Git.new @name, @repository, "other", false
source.cache
refute_equal master_head, source.rev_parse
- source = Gem::Source::Git.new @name, @repository, 'nonexistent', false
+ source = Gem::Source::Git.new @name, @repository, "nonexistent", false
source.cache
@@ -204,38 +204,38 @@ class TestGemSourceGit < Gem::TestCase
end
def test_spaceship
- git = Gem::Source::Git.new 'a', 'git/a', 'master', false
+ git = Gem::Source::Git.new "a", "git/a", "master", false
remote = Gem::Source.new @gem_repo
installed = Gem::Source::Installed.new
- vendor = Gem::Source::Vendor.new 'vendor/foo'
+ vendor = Gem::Source::Vendor.new "vendor/foo"
- assert_equal(0, git.<=>(git), 'git <=> git')
+ assert_equal(0, git.<=>(git), "git <=> git")
- assert_equal(1, git.<=>(remote), 'git <=> remote')
- assert_equal(-1, remote.<=>(git), 'remote <=> git')
+ assert_equal(1, git.<=>(remote), "git <=> remote")
+ assert_equal(-1, remote.<=>(git), "remote <=> git")
- assert_equal(1, git.<=>(installed), 'git <=> installed')
- assert_equal(-1, installed.<=>(git), 'installed <=> git')
+ assert_equal(1, git.<=>(installed), "git <=> installed")
+ assert_equal(-1, installed.<=>(git), "installed <=> git")
- assert_equal(-1, git.<=>(vendor), 'git <=> vendor')
- assert_equal(1, vendor.<=>(git), 'vendor <=> git')
+ assert_equal(-1, git.<=>(vendor), "git <=> vendor")
+ assert_equal(1, vendor.<=>(git), "vendor <=> git")
end
def test_specs
- source = Gem::Source::Git.new @name, @repository, 'master', true
+ source = Gem::Source::Git.new @name, @repository, "master", true
- Dir.chdir 'git/a' do
- FileUtils.mkdir 'b'
+ Dir.chdir "git/a" do
+ FileUtils.mkdir "b"
- Dir.chdir 'b' do
- b = Gem::Specification.new 'b', 1
+ Dir.chdir "b" do
+ b = Gem::Specification.new "b", 1
- File.open 'b.gemspec', 'w' do |io|
+ File.open "b.gemspec", "w" do |io|
io.write b.to_ruby
end
- system @git, 'add', 'b.gemspec'
- system @git, 'commit', '--quiet', '-m', 'add b/b.gemspec'
+ system @git, "add", "b.gemspec"
+ system @git, "commit", "--quiet", "-m", "add b/b.gemspec"
end
end
@@ -252,11 +252,11 @@ class TestGemSourceGit < Gem::TestCase
base_dir = File.dirname File.dirname source.install_dir
assert_equal source.install_dir, a_spec.full_gem_path
- assert_equal File.join(source.install_dir, 'a.gemspec'), a_spec.loaded_from
+ assert_equal File.join(source.install_dir, "a.gemspec"), a_spec.loaded_from
assert_equal base_dir, a_spec.base_dir
extension_dir =
- File.join Gem.dir, 'bundler', 'extensions',
+ File.join Gem.dir, "bundler", "extensions",
Gem::Platform.local.to_s, Gem.extension_api_version,
"a-#{source.dir_shortref}"
@@ -264,8 +264,8 @@ class TestGemSourceGit < Gem::TestCase
b_spec = specs.shift
- assert_equal File.join(source.install_dir, 'b'), b_spec.full_gem_path
- assert_equal File.join(source.install_dir, 'b', 'b.gemspec'),
+ assert_equal File.join(source.install_dir, "b"), b_spec.full_gem_path
+ assert_equal File.join(source.install_dir, "b", "b.gemspec"),
b_spec.loaded_from
assert_equal base_dir, b_spec.base_dir
@@ -273,7 +273,7 @@ class TestGemSourceGit < Gem::TestCase
end
def test_specs_local
- source = Gem::Source::Git.new @name, @repository, 'master', true
+ source = Gem::Source::Git.new @name, @repository, "master", true
source.remote = false
capture_output do
@@ -289,15 +289,15 @@ class TestGemSourceGit < Gem::TestCase
assert_equal @hash, @source.uri_hash
source =
- Gem::Source::Git.new 'a', 'http://git@example/repo.git', 'master', false
+ Gem::Source::Git.new "a", "http://git@example/repo.git", "master", false
- assert_equal '291c4caac7feba8bb64c297987028acb3dde6cfe',
+ assert_equal "291c4caac7feba8bb64c297987028acb3dde6cfe",
source.uri_hash
source =
- Gem::Source::Git.new 'a', 'HTTP://git@EXAMPLE/repo.git', 'master', false
+ Gem::Source::Git.new "a", "HTTP://git@EXAMPLE/repo.git", "master", false
- assert_equal '291c4caac7feba8bb64c297987028acb3dde6cfe',
+ assert_equal "291c4caac7feba8bb64c297987028acb3dde6cfe",
source.uri_hash
end
end