Move updater mock into test class namespace

This commit is contained in:
Jack Nagel 2014-06-10 20:03:37 -05:00
parent d8f86f290b
commit 65673d60c1

View File

@ -2,7 +2,8 @@ require 'testing_env'
require 'cmd/update' require 'cmd/update'
require 'yaml' require 'yaml'
class UpdaterMock < Updater class UpdaterTests < Test::Unit::TestCase
class UpdaterMock < ::Updater
def in_repo_expect(cmd, output = '') def in_repo_expect(cmd, output = '')
@outputs ||= Hash.new { |h,k| h[k] = [] } @outputs ||= Hash.new { |h,k| h[k] = [] }
@expected ||= [] @expected ||= []
@ -17,7 +18,7 @@ class UpdaterMock < Updater
@called << cmd @called << cmd
@outputs[cmd].shift @outputs[cmd].shift
else else
raise "#<#{self.class.name} #{object_id}> unexpectedly called backticks: `#{cmd}'" raise "#{inspect} unexpectedly called backticks: `#{cmd}`"
end end
end end
@ -26,9 +27,8 @@ class UpdaterMock < Updater
def expectations_met? def expectations_met?
@expected == @called @expected == @called
end end
end end
class UpdaterTests < Test::Unit::TestCase
def fixture(name) def fixture(name)
self.class.fixture_data[name] self.class.fixture_data[name]
end end