Last active
March 4, 2021 15:55
-
-
Save danielpaul/f73a7779360d14c81dd9de111931bf82 to your computer and use it in GitHub Desktop.
MiniTest Example
This file contains 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
require 'minitest/autorun' | |
class ValidPhoneNumberTest < Minitest::Test | |
def test_when_valid_phone_number | |
assert is_valid_phone_number("(123) 456-7890") | |
end | |
def test_extra_extra_number_missing_bracket | |
refute is_valid_phone_number("1111)555 2345") | |
end | |
def test_with_missing_bracket | |
refute is_valid_phone_number("098) 123 4567") | |
end | |
def test_less_numbers | |
refute is_valid_phone_number("(0) 123-4567") | |
end | |
def test_more_numbers | |
refute is_valid_phone_number("(00111) 123-4567") | |
end | |
def test_dash_missing | |
refute is_valid_phone_number("(123) 456 7890") | |
end | |
def test_dash_in_wrong_place | |
refute is_valid_phone_number("(123)-456 7890") | |
end | |
def test_when_not_numbers | |
refute is_valid_phone_number("(abc) def-ghij") | |
end | |
def test_when_some_not_numbers | |
refute is_valid_phone_number("(123) 4a6-7890") | |
end | |
end | |
def is_valid_phone_number(string) | |
# write your solution here that return true/false | |
false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment