From df7756aeb9bbf13d3dc2a65fa291ff6625a48e69 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 10 Jun 2014 20:03:57 -0500 Subject: Pull mock initialization code into initialize --- Library/Homebrew/test/test_updater.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/test/test_updater.rb b/Library/Homebrew/test/test_updater.rb index 91c7fee0f..0d3cbc7fa 100644 --- a/Library/Homebrew/test/test_updater.rb +++ b/Library/Homebrew/test/test_updater.rb @@ -4,9 +4,14 @@ require 'yaml' class UpdaterTests < Test::Unit::TestCase class UpdaterMock < ::Updater + def initialize(*args) + super + @outputs = Hash.new { |h, k| h[k] = [] } + @expected = [] + @called = [] + end + def in_repo_expect(cmd, output = '') - @outputs ||= Hash.new { |h,k| h[k] = [] } - @expected ||= [] @expected << cmd @outputs[cmd] << output end @@ -14,7 +19,6 @@ class UpdaterTests < Test::Unit::TestCase def `(cmd, *args) cmd = "#{cmd} #{args*' '}".strip if @expected.include?(cmd) and !@outputs[cmd].empty? - @called ||= [] @called << cmd @outputs[cmd].shift else -- cgit v1.2.3