Skip to content

Commit 9634f52

Browse files
committed
unit tests
1 parent 5d378ff commit 9634f52

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

spec/models/puppy_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
describe 'Puppy class' do
2+
let!(:puppy) { Puppy.new("brad", "black lab", 2) }
3+
4+
it 'can create a new instance of the puppy class'
5+
expect(Puppy.new("brad", "black lab", 2)).to be_an_instance_of(Puppy)
6+
do
7+
8+
it 'can read a puppy name' do
9+
expect(puppy.name).to eq("brad")
10+
end
11+
12+
it 'can read a puppy breed' do
13+
expect(puppy.name).to eq("black lab")
14+
end
15+
16+
it 'can read a puppy age' do
17+
expect(puppy.name).to eq(2)
18+
end
19+
20+
it 'can change puppy age' do
21+
puppy.age = 3
22+
expect(puppy.age).to eq(3)
23+
end
24+
25+
it 'can change puppy name' do
26+
puppy.name = "brad the beast"
27+
expect(puppy.name).to eq("brad the beast")
28+
end
29+
30+
it 'can change puppy breed' do
31+
puppy.breed = "the best black lab"
32+
expect(puppy.breed).to eq("the best black lab")
33+
end
34+
end

0 commit comments

Comments
 (0)