Created
January 19, 2017 09:43
-
-
Save therod/8e21597c643039b61360320b90a044dd to your computer and use it in GitHub Desktop.
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
# We require the minitest library | |
require 'minitest/autorun' | |
# CLASS DEFINITION | |
class Person | |
attr_accessor :age, :name | |
def say(name) | |
"Hi, my name is test blablabla #{name}" | |
end | |
end | |
# TESTS FOR THE PERSON CLASS | |
class PersonTest < Minitest::Test | |
def setup | |
@angela = Person.new | |
end | |
def test_say | |
assert_match /Angela/, @angela.say("Angela") | |
assert_kind_of String, @angela.say("Angela") | |
end | |
def test_age | |
@angela.age = 20 | |
assert_equal 20, @angela.age | |
end | |
def test_respond_to_name | |
assert_respond_to @angela, :name | |
assert_respond_to @angela, :age | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment