-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_test.rb
52 lines (40 loc) · 858 Bytes
/
sample_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require_relative 'minitestw'
class SampleTest < Minitestw::Test
def setup
@user = User.new(correct_name, correct_email)
end
def test_name_with_email
assert_equal correct_name_with_email, @user.name_with_email
end
def test_this_fails
assert @user.name.nil?
assert @user.email.nil?
end
def test_one_passes_one_fails
assert_equal correct_name, @user.name
assert_equal wrong_email, @user.email
end
private
def correct_name_with_email
"#{correct_name} <#{correct_email}>"
end
def correct_name
'Kasa'
end
def correct_email
'kasa@rubyconftw2023.com'
end
def wrong_email
'kasahsiao@rubyconftw2023.com'
end
end
class User
attr_accessor :name, :email
def initialize(name, email)
@name = name
@email = email
end
def name_with_email
"#{name} <#{email}>"
end
end