Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
francksefu committed Sep 7, 2023
2 parents 280f590 + d617eec commit 9a51506
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
- **Implement book & rental associations**
- **Built interactive console app**
- **Make sure it use SOLID, YAGNI, KISS, DRY principles**
- **Preserve data**
- **Run Unit tests using Rspec**

<p align="right">(<a href="#readme-top">back to top</a>)</p>

Expand Down Expand Up @@ -105,8 +107,7 @@ To fix the linter use:

## 🔭 Future Features <a name="future-features"></a>

- [ ] **Run tests**
- [ ] **Preserve data**
- [ ] **Add Delete and Update options for stored data**

<p align="right">(<a href="#readme-top">back to top</a>)</p>

Expand Down
29 changes: 29 additions & 0 deletions spec/classroom_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require_relative 'spec_helper'
require_relative '../classroom.rb'

describe Classroom do
let(:classroom) { Classroom.new('Back End Program') }
let(:student) { double('student') }

describe '#initialize' do
it 'creates a new Classroom instance' do
expect(classroom).to be_an_instance_of(Classroom)
end

it "initializes a Classroom object with label" do
expect(classroom.label).to eq('Back End Program')
end

it "initializes a Classroom object with an empty student array" do
expect(classroom.student).to be_empty
end
end

describe '#add_student' do
it "adds a student to the classroom" do
expect(student).to receive(:assign_classroom).with(classroom)
classroom.add_student(student)
expect(classroom.student).to include(student)
end
end
end

0 comments on commit 9a51506

Please sign in to comment.