Skip to content

Commit

Permalink
Add the required test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekyHacks committed Oct 28, 2023
1 parent ad056d9 commit 6864651
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions spec/person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@
expect(@person.instance_variable_get(:@id)).not_to be_nil
end
end
describe '#@id' do
it 'should return a random id for the person object' do
@id = Random.rand(1..1000)
expect(@person.instance_variable_get(:@id)).not_to be_nil

describe '#of_age?' do
it 'should return true if age is greater or equal to 18' do
expect(@person.age).to be >= 18
end
end
describe '#can_use_services?' do
it 'should return true if parent_permission or of_age? is true' do
expect(@person.can_use_services?).to be true
end
describe '#of_age?' do
it 'should return true if age is greater or equal to 18' do
expect(@person.age).to be >= 18
end

it 'should return false if parent_permission and of_age? are false' do
@person = Person.new(16, 'name', parent_permission: false)
expect(@person.can_use_services?).to be false
end
end
describe '#add_rental' do
Expand Down

0 comments on commit 6864651

Please sign in to comment.