Created
June 8, 2012 05:54
-
-
Save maryannvalentine/2893853 to your computer and use it in GitHub Desktop.
Wine Glass Homework (write two more tests)
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
class WineGlass | |
attr_accessor :material, :volume, :stem_length | |
def pretty_print_material | |
"Material : #{material}" | |
end | |
def pretty_print_stuff | |
return "This wine glass is cool. It has a stem length of 5 and a volume of 69ml" | |
end | |
end | |
require 'minitest/autorun' | |
class TestWineGlass < MiniTest::Unit::TestCase | |
def setup | |
@wg =WineGlass.new | |
end | |
def test_that_wine_glasses_have_volume | |
assert_respond_to @wg, :volume | |
end | |
def test_that_wg_had_a_pretty_print_for_material | |
@wg.material ='marble' | |
assert_equal "Material : #{@wg.material}", @wg.pretty_print_material | |
end | |
def test_wg_pretty_prints_stem_length_and_volume | |
assert_equal "This wine glass is cool. It has a stem length of 5 and a volume of 69ml", @wg.pretty_print_stuff | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment