aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/test/support
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-09 04:39:53 +0100
committerMarkus Reiter2017-02-10 17:19:19 +0100
commit31b9dc28e3105d9164fb28d7e29985ba1f1775eb (patch)
tree7ccaf0268385f3d7c0d52e866426798a2f524917 /Library/Homebrew/cask/test/support
parentb9de5c04908bbbe2e2c30fff57b1301e17082202 (diff)
downloadbrew-31b9dc28e3105d9164fb28d7e29985ba1f1775eb.tar.bz2
Remove cask test directory.
Diffstat (limited to 'Library/Homebrew/cask/test/support')
-rw-r--r--Library/Homebrew/cask/test/support/cleanup.rb10
-rw-r--r--Library/Homebrew/cask/test/support/fake_dirs.rb31
-rw-r--r--Library/Homebrew/cask/test/support/fake_system_command.rb77
-rw-r--r--Library/Homebrew/cask/test/support/shared_examples.rb25
4 files changed, 0 insertions, 143 deletions
diff --git a/Library/Homebrew/cask/test/support/cleanup.rb b/Library/Homebrew/cask/test/support/cleanup.rb
deleted file mode 100644
index c31a74be2..000000000
--- a/Library/Homebrew/cask/test/support/cleanup.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module MiniTest
- class Spec
- def after_teardown
- super
- Hbc.installed.each do |cask|
- Hbc::Installer.new(cask).purge_versioned_files
- end
- end
- end
-end
diff --git a/Library/Homebrew/cask/test/support/fake_dirs.rb b/Library/Homebrew/cask/test/support/fake_dirs.rb
deleted file mode 100644
index ea7acc685..000000000
--- a/Library/Homebrew/cask/test/support/fake_dirs.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# wire in a set of fake link dirs per-test
-module FakeDirHooks
- DIRS = [:appdir, :qlplugindir, :binarydir].freeze
-
- def before_setup
- super
-
- @canned_dirs = {}
-
- DIRS.each do |dir_name|
- dir = HOMEBREW_PREFIX.join("#{dir_name}-#{Time.now.to_i}-#{rand(1024)}")
- dir.mkpath
- Hbc.send("#{dir_name}=", dir)
- @canned_dirs[:dir_name] = dir
- end
- end
-
- def after_teardown
- super
-
- @canned_dirs.each_value do |dir|
- dir.rmtree if dir.exist?
- end
- end
-end
-
-module MiniTest
- class Spec
- include FakeDirHooks
- end
-end
diff --git a/Library/Homebrew/cask/test/support/fake_system_command.rb b/Library/Homebrew/cask/test/support/fake_system_command.rb
deleted file mode 100644
index 97efd0761..000000000
--- a/Library/Homebrew/cask/test/support/fake_system_command.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-module Hbc
- class FakeSystemCommand
- def self.responses
- @responses ||= {}
- end
-
- def self.expectations
- @expectations ||= {}
- end
-
- def self.system_calls
- @system_calls ||= Hash.new(0)
- end
-
- def self.clear
- @responses = nil
- @expectations = nil
- @system_calls = nil
- end
-
- def self.stubs_command(command, response = "")
- responses[command] = response
- end
-
- def self.expects_command(command, response = "", times = 1)
- stubs_command(command, response)
- expectations[command] = times
- end
-
- def self.expect_and_pass_through(command, times = 1)
- pass_through = ->(cmd, opts) { Hbc::SystemCommand.run(cmd, opts) }
- expects_command(command, pass_through, times)
- end
-
- def self.verify_expectations!
- expectations.each do |command, times|
- unless system_calls[command] == times
- raise("expected #{command.inspect} to be run #{times} times, but got #{system_calls[command]}")
- end
- end
- end
-
- def self.run(command_string, options = {})
- command = Hbc::SystemCommand.new(command_string, options).command
- unless responses.key?(command)
- raise("no response faked for #{command.inspect}, faked responses are: #{responses.inspect}")
- end
- system_calls[command] += 1
-
- response = responses[command]
- if response.respond_to?(:call)
- response.call(command_string, options)
- else
- Hbc::SystemCommand::Result.new(command, response, "", 0)
- end
- end
-
- def self.run!(command, options = {})
- run(command, options.merge(must_succeed: true))
- end
- end
-end
-
-module FakeSystemCommandHooks
- def after_teardown
- super
- Hbc::FakeSystemCommand.verify_expectations!
- ensure
- Hbc::FakeSystemCommand.clear
- end
-end
-
-module MiniTest
- class Spec
- include FakeSystemCommandHooks
- end
-end
diff --git a/Library/Homebrew/cask/test/support/shared_examples.rb b/Library/Homebrew/cask/test/support/shared_examples.rb
deleted file mode 100644
index 594ca81c1..000000000
--- a/Library/Homebrew/cask/test/support/shared_examples.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# Adapted from https://gist.github.com/jodosha/1560208
-MiniTest::Spec.class_eval do
- def self.shared_examples
- @shared_examples ||= {}
- end
-end
-
-module MiniTest
- class Spec
- module SharedExamples
- def shared_examples_for(desc, &block)
- MiniTest::Spec.shared_examples[desc] = block
- end
-
- def it_behaves_like(desc, *args, &block)
- instance_exec(*args, &MiniTest::Spec.shared_examples[desc])
- instance_eval(&block) if block_given?
- end
- end
- end
-end
-
-Object.class_eval do
- include(MiniTest::Spec::SharedExamples)
-end