When util is included, extend the class as well [closes GH-83]
This commit is contained in:
parent
a5648abe92
commit
cce82305ee
|
@ -0,0 +1,7 @@
|
|||
module Vagrant
|
||||
module Util
|
||||
def self.included(base)
|
||||
base.extend(self)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
||||
|
||||
class UtilTest < Test::Unit::TestCase
|
||||
class UtilIncludeTest
|
||||
include Vagrant::Util
|
||||
end
|
||||
|
||||
setup do
|
||||
@klass = UtilIncludeTest
|
||||
end
|
||||
|
||||
context "with a class" do
|
||||
should "have the util methods" do
|
||||
assert @klass.respond_to?(:error_and_exit)
|
||||
end
|
||||
end
|
||||
|
||||
context "with an instance" do
|
||||
setup do
|
||||
@instance = @klass.new
|
||||
end
|
||||
|
||||
should "have the util methods" do
|
||||
assert @instance.respond_to?(:error_and_exit)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue