aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2016-09-12 08:08:12 +0100
committerGitHub2016-09-12 08:08:12 +0100
commitb93b60e6ca3d609267fd20f35c63527552f10f19 (patch)
treea9c95e1a505a39ddb08c72029c124891c2b2185f /Library/Homebrew
parent5d9ee6b1d4cfcb5a270bfabaa1d0b17a85fff2aa (diff)
parente24a890e593d665e8f4bad2588879602e3918a87 (diff)
downloadbrew-b93b60e6ca3d609267fd20f35c63527552f10f19.tar.bz2
Merge pull request #924 from MikeMcQuaid/test-rubocop
Fix Library/Homebrew/test RuboCop warnings
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/test/test_dependency_collector.rb2
-rw-r--r--Library/Homebrew/test/test_formula.rb7
-rw-r--r--Library/Homebrew/test/test_formula_installer.rb2
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb20
-rw-r--r--Library/Homebrew/test/test_os_mac_language.rb2
-rw-r--r--Library/Homebrew/test/test_resource.rb8
-rw-r--r--Library/Homebrew/test/test_shell.rb10
-rw-r--r--Library/Homebrew/test/test_tab.rb2
8 files changed, 28 insertions, 25 deletions
diff --git a/Library/Homebrew/test/test_dependency_collector.rb b/Library/Homebrew/test/test_dependency_collector.rb
index a784a10bc..9ef2a8cc7 100644
--- a/Library/Homebrew/test/test_dependency_collector.rb
+++ b/Library/Homebrew/test/test_dependency_collector.rb
@@ -7,7 +7,7 @@ class DependencyCollectorTests < Homebrew::TestCase
end
def find_requirement(klass)
- @d.requirements.find { |req| klass === req }
+ @d.requirements.find { |req| req.is_a? klass }
end
def setup
diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb
index 8dd77e186..eb276073a 100644
--- a/Library/Homebrew/test/test_formula.rb
+++ b/Library/Homebrew/test/test_formula.rb
@@ -574,7 +574,7 @@ class FormulaTests < Homebrew::TestCase
url "foo-1.0"
pour_bottle? do
reason "true reason"
- satisfy { var == var }
+ satisfy { true }
end
end
assert f_true.pour_bottle?
@@ -586,7 +586,10 @@ class OutdatedVersionsTests < Homebrew::TestCase
attr_reader :f
def setup
- @f = formula { url "foo"; version "1.20" }
+ @f = formula do
+ url "foo"
+ version "1.20"
+ end
@outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.11"
@same_prefix = HOMEBREW_CELLAR/"#{f.name}/1.20"
@greater_prefix = HOMEBREW_CELLAR/"#{f.name}/1.21"
diff --git a/Library/Homebrew/test/test_formula_installer.rb b/Library/Homebrew/test/test_formula_installer.rb
index f519d0715..51bec7589 100644
--- a/Library/Homebrew/test/test_formula_installer.rb
+++ b/Library/Homebrew/test/test_formula_installer.rb
@@ -110,7 +110,7 @@ class FormulaInstallerTests < Homebrew::TestCase
dependent = formula do
url "foo"
version "0.5"
- depends_on "#{dependency.name}"
+ depends_on dependency.name.to_s
end
dependency.prefix("0.1").join("bin/a").mkpath
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index ead87c8ab..812d26ba5 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -99,7 +99,7 @@ class IntegrationCommandTests < Homebrew::TestCase
def cmd(*args)
output = cmd_output(*args)
status = $?.exitstatus
- puts "\n#{output}" if status != 0
+ puts "\n#{output}" if status.nonzero?
assert_equal 0, status
output
end
@@ -107,7 +107,7 @@ class IntegrationCommandTests < Homebrew::TestCase
def cmd_fail(*args)
output = cmd_output(*args)
status = $?.exitstatus
- $stderr.puts "\n#{output}" if status == 0
+ $stderr.puts "\n#{output}" if status.zero?
refute_equal 0, status
output
end
@@ -228,23 +228,23 @@ class IntegrationCommandTests < Homebrew::TestCase
end
def test_env_bash
- assert_match %r{export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"},
- cmd("--env", "--shell=bash")
+ assert_match(/export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
+ cmd("--env", "--shell=bash"))
end
def test_env_fish
- assert_match %r{set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"},
- cmd("--env", "--shell=fish")
+ assert_match(/set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/,
+ cmd("--env", "--shell=fish"))
end
def test_env_csh
- assert_match %r{setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};},
- cmd("--env", "--shell=tcsh")
+ assert_match(/setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};/,
+ cmd("--env", "--shell=tcsh"))
end
def test_env_plain
- assert_match %r{CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}},
- cmd("--env", "--plain")
+ assert_match(/CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}/,
+ cmd("--env", "--plain"))
end
def test_prefix_formula
diff --git a/Library/Homebrew/test/test_os_mac_language.rb b/Library/Homebrew/test/test_os_mac_language.rb
index 6cc9525b4..2cdd50917 100644
--- a/Library/Homebrew/test/test_os_mac_language.rb
+++ b/Library/Homebrew/test/test_os_mac_language.rb
@@ -3,6 +3,6 @@ require "os/mac"
class OSMacLanguageTests < Homebrew::TestCase
def test_language_format
- assert_match %r{\A[a-z]{2}(-[A-Z]{2})?\Z}, OS::Mac.language
+ assert_match(/\A[a-z]{2}(-[A-Z]{2})?\Z/, OS::Mac.language)
end
end
diff --git a/Library/Homebrew/test/test_resource.rb b/Library/Homebrew/test/test_resource.rb
index 9f0b1ca98..b0e0d1b72 100644
--- a/Library/Homebrew/test/test_resource.rb
+++ b/Library/Homebrew/test/test_resource.rb
@@ -100,8 +100,8 @@ class ResourceTests < Homebrew::TestCase
def test_download_strategy
strategy = Object.new
- DownloadStrategyDetector.
- expects(:detect).with("foo", nil).returns(strategy)
+ DownloadStrategyDetector
+ .expects(:detect).with("foo", nil).returns(strategy)
@resource.url("foo")
assert_equal strategy, @resource.download_strategy
end
@@ -120,8 +120,8 @@ class ResourceTests < Homebrew::TestCase
fn = stub(:file? => true)
checksum = @resource.sha256(TEST_SHA256)
- fn.expects(:verify_checksum).with(checksum).
- raises(ChecksumMismatchError.new(fn, checksum, Object.new))
+ fn.expects(:verify_checksum).with(checksum)
+ .raises(ChecksumMismatchError.new(fn, checksum, Object.new))
shutup do
assert_raises(ChecksumMismatchError) do
diff --git a/Library/Homebrew/test/test_shell.rb b/Library/Homebrew/test/test_shell.rb
index 5e054f9d9..877acb5c8 100644
--- a/Library/Homebrew/test/test_shell.rb
+++ b/Library/Homebrew/test/test_shell.rb
@@ -2,7 +2,7 @@ require "testing_env"
require "utils/shell"
class ShellSmokeTest < Homebrew::TestCase
- def test_path_to_shell()
+ def test_path_to_shell
# raw command name
assert_equal :bash, Utils::Shell.path_to_shell("bash")
# full path
@@ -13,13 +13,13 @@ class ShellSmokeTest < Homebrew::TestCase
assert_equal :zsh, Utils::Shell.path_to_shell("zsh-5.2\n")
end
- def test_path_to_shell_failure()
+ def test_path_to_shell_failure
assert_equal nil, Utils::Shell.path_to_shell("")
assert_equal nil, Utils::Shell.path_to_shell("@@@@@@")
assert_equal nil, Utils::Shell.path_to_shell("invalid_shell-4.2")
end
- def test_sh_quote()
+ def test_sh_quote
assert_equal "''", Utils::Shell.sh_quote("")
assert_equal "\\\\", Utils::Shell.sh_quote("\\")
assert_equal "'\n'", Utils::Shell.sh_quote("\n")
@@ -27,7 +27,7 @@ class ShellSmokeTest < Homebrew::TestCase
assert_equal "word", Utils::Shell.sh_quote("word")
end
- def test_csh_quote()
+ def test_csh_quote
assert_equal "''", Utils::Shell.csh_quote("")
assert_equal "\\\\", Utils::Shell.csh_quote("\\")
# note this test is different than for sh
@@ -49,7 +49,7 @@ class ShellSmokeTest < Homebrew::TestCase
ENV["SHELL"] = original_shell
end
- def test_prepend_path_in_shell_profile()
+ def test_prepend_path_in_shell_profile
prepend_path_shell "/bin/tcsh", "/path", "echo 'setenv PATH /path"
prepend_path_shell "/bin/bash", "/path", "echo 'export PATH=\"/path"
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index 962bfc602..0b8fb2a64 100644
--- a/Library/Homebrew/test/test_tab.rb
+++ b/Library/Homebrew/test/test_tab.rb
@@ -24,7 +24,7 @@ class TabTests < Homebrew::TestCase
"stable" => "0.10",
"devel" => "0.14",
"head" => "HEAD-1111111",
- }
+ },
})
end