Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Kata Test Case

class TestStepOne
def test_unidirectional
jim = User.new("Jim")
admin = Role.new("Admin")
jim.add_role(admin)
user.add_user(jim)
assert_equals [admin], jim.roles
assert_equals [jim], admin.users
end
end

class TestStepTwo
def test_bidirectional_from_user
jim = User.new("Jim")
admin = Role.new("Admin")
jim.add(admin)
assert_equals [admin], jim.roles
assert_equals [jim], admin.users
end

def test_bidirectional_from_role
jim = User.new("Jim")
admin = Role.new("Admin")
admin.add(jim)
assert_equals [admin], jim.roles
assert_equals [jim], admin.users
end
end

You need to create an account or log in to post comments to this site.


Click here to browse all 5349 code snippets