Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ihollander committed Apr 30, 2021
1 parent 9b93ad5 commit 784c662
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions spec/models/student_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'rails_helper'

RSpec.describe Student, type: :model do
let!(:student) { Student.new(first_name: 'Dwayne', last_name: 'Johnson', grade: 99) }

describe '#first_name' do
it 'returns the student\'s first name' do
expect(student.first_name).to eq('Dwayne')
end
end

describe '#last_name' do
it 'returns the student\'s last name' do
expect(student.last_name).to eq('Johnson')
end
end

describe '#grade' do
it 'returns the student\'s grade' do
expect(student.grade).to eq(99)
end
end

describe '#to_s' do
it 'has a #to_s method that returns the student\'s full name' do
expect(student.to_s).to eq('Dwayne Johnson')
end
end
end

0 comments on commit 784c662

Please sign in to comment.