Testing with errors Flashcards

1
Q

How would you write a test for a Dog class that raises an error if no name is filled in on initalize

A

describe Dog do
it ‘raises error if no name is entered on initialize’ do
expect {described_class.new()}.to raise_error(‘A name is requirred’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly