Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created March 7, 2010 18:11
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/324519 to your computer and use it in GitHub Desktop.
Save floehopper/324519 to your computer and use it in GitHub Desktop.
require 'test/unit'
require 'mocha'
class MyTest < Test::Unit::TestCase
class X
class << self
def foo(&block)
append_before_filter do
bar &block
end
end
def append_before_filter(&block); end
end
end
def test_me
X.expects(:bar).yields
X.stubs(:append_before_filter).yields
my_block_called = false
X.foo do
my_block_called = true
end
assert my_block_called
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment