aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_updater.rb
diff options
context:
space:
mode:
authorJack Nagel2014-06-10 20:03:37 -0500
committerJack Nagel2014-06-10 20:03:37 -0500
commiteb9d1386c77ce45f9364bf4d0e6c456167988e3c (patch)
tree31e0df93b1b262e4d25354fc6e133e565f5fca6a /Library/Homebrew/test/test_updater.rb
parent9b1ea897a341b5a23f0a3ad6b6ba4f614fa7e6ec (diff)
downloadhomebrew-eb9d1386c77ce45f9364bf4d0e6c456167988e3c.tar.bz2
Move updater mock into test class namespace
Diffstat (limited to 'Library/Homebrew/test/test_updater.rb')
-rw-r--r--Library/Homebrew/test/test_updater.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/Library/Homebrew/test/test_updater.rb b/Library/Homebrew/test/test_updater.rb
index a7e4f3b46..91c7fee0f 100644
--- a/Library/Homebrew/test/test_updater.rb
+++ b/Library/Homebrew/test/test_updater.rb
@@ -2,33 +2,33 @@ require 'testing_env'
require 'cmd/update'
require 'yaml'
-class UpdaterMock < Updater
- def in_repo_expect(cmd, output = '')
- @outputs ||= Hash.new { |h,k| h[k] = [] }
- @expected ||= []
- @expected << cmd
- @outputs[cmd] << output
- end
+class UpdaterTests < Test::Unit::TestCase
+ class UpdaterMock < ::Updater
+ def in_repo_expect(cmd, output = '')
+ @outputs ||= Hash.new { |h,k| h[k] = [] }
+ @expected ||= []
+ @expected << cmd
+ @outputs[cmd] << output
+ end
- def `(cmd, *args)
- cmd = "#{cmd} #{args*' '}".strip
- if @expected.include?(cmd) and !@outputs[cmd].empty?
- @called ||= []
- @called << cmd
- @outputs[cmd].shift
- else
- raise "#<#{self.class.name} #{object_id}> unexpectedly called backticks: `#{cmd}'"
+ def `(cmd, *args)
+ cmd = "#{cmd} #{args*' '}".strip
+ if @expected.include?(cmd) and !@outputs[cmd].empty?
+ @called ||= []
+ @called << cmd
+ @outputs[cmd].shift
+ else
+ raise "#{inspect} unexpectedly called backticks: `#{cmd}`"
+ end
end
- end
- alias safe_system ` #`
+ alias safe_system ` #`
- def expectations_met?
- @expected == @called
+ def expectations_met?
+ @expected == @called
+ end
end
-end
-class UpdaterTests < Test::Unit::TestCase
def fixture(name)
self.class.fixture_data[name]
end