Skip to content

Instantly share code, notes, and snippets.

@maryannvalentine
Created June 8, 2012 05:54
Show Gist options
  • Save maryannvalentine/2893853 to your computer and use it in GitHub Desktop.
Save maryannvalentine/2893853 to your computer and use it in GitHub Desktop.
Wine Glass Homework (write two more tests)
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