Skip to content

Instantly share code, notes, and snippets.

@drnic
Created September 15, 2008 09:42
Show Gist options
  • Save drnic/10829 to your computer and use it in GitHub Desktop.
Save drnic/10829 to your computer and use it in GitHub Desktop.
class PonyList
def initialize(ponies = [])
@ponies = ponies
end
def empty?
@ponies.empty?
end
def add(pony)
@ponies << pony
end
end
if $0 == __FILE__
require "test/unit"
require "rubygems"
require "Shoulda"
class Test::Unit::TestCase
def self.should_be_empty
should "be empty" do
assert(@list.empty?)
end
end
def self.should_not_be_empty
should "not be empty" do
assert(!@list.empty?)
end
end
end
class TestPonyLists < Test::Unit::TestCase
def test_case_name
assert(true, "Failure message.")
end
context "new PonyList" do
setup { @list = PonyList.new }
should_be_empty
context "with an extra Pony" do
setup { @list.add "Grey" }
should_not_be_empty
should "contain names of pony types" do
end
end
end
context "PonyList with ponies" do
setup do
@list = PonyList.new(%w[White Black])
end
should_not_be_empty
should "be not empty" do
assert(!@list.empty?)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment