Created
June 15, 2009 22:12
-
-
Save jdunphy/130383 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'test/unit' | |
require 'mocha' | |
class Foo | |
def self.foo(a_param) | |
a_param.upcase | |
end | |
end | |
class FooTest < Test::Unit::TestCase | |
def test_foo_should_get_a_thing | |
Foo.expects(:foo).with("a string").returns("A STRING") | |
Foo.foo("a string") | |
end | |
def test_foo_works_with_partial_matches | |
Foo.expects(:foo).with { |value| value =~ /ring/ }.returns("SOMETHING") | |
Foo.foo(%22a string") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment