require "test/unit"
require "mocha"


class A
  class <<self
    def foo
      new
    end
  end
end

class B < A
end

class C
  def from_A
    A.foo
  end
end


class ATest < Test::Unit::TestCase
  def setup
    @base = C.new
  end

  def test_using_expects
    A.expects(:foo).returns(:output)
    assert_equal @base.from_A, :output
  end
end

class BTest < Test::Unit::TestCase
  def test_using_foo
    assert_instance_of B, B.foo
  end
end
