Created
December 11, 2009 00:49
-
-
Save vangberg/253870 to your computer and use it in GitHub Desktop.
This file contains 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
$ ruby setter-return.rb | |
Loaded suite setter-return | |
Started | |
F | |
Finished in 0.008396 seconds. | |
1) Failure: | |
test_return_value_of_setter(TestFoo) [setter-return.rb:17]: | |
<4> expected but was | |
<2>. | |
1 tests, 1 assertions, 1 failures, 0 errors | |
$ |
This file contains 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 'test/unit' | |
class Foo | |
attr_reader :bar | |
def bar=(baz) | |
@bar = baz * 2 | |
end | |
end | |
class TestFoo < Test::Unit::TestCase | |
def setup | |
@foo = Foo.new | |
end | |
def test_return_value_of_setter | |
assert_equal 4, @foo.bar = 2 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment