Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created December 22, 2011 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floehopper/1511111 to your computer and use it in GitHub Desktop.
Save floehopper/1511111 to your computer and use it in GitHub Desktop.
require "test/unit"
require "rubygems"
require "mocha"
class Foo
def self.foo
"foo"
end
end
class FooChildOne < Foo
def self.foo
"foo-child-one"
end
end
class FooChildTwo < Foo
def self.foo
"foo-child-two"
end
end
class FooTest < Test::Unit::TestCase
def test_foo
FooChildOne.expects(:foo)
FooChildTwo.expects(:foo)
FooChildOne.foo
FooChildTwo.foo
end
end
# this behaves as I would expect i.e. the test passes unless I remove one or more of the calls to `FooChildOne.foo` or `FooChildTwo.foo`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment