Skip to content

Commit

Permalink
Initialized rspec file and fixed linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lilskyex0x committed Nov 17, 2023
1 parent a0775b1 commit b4df7a2
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 195 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
source 'https://rubygems.org'

gem 'pry'
gem 'rspec', '~> 3.0'
gem 'rubocop', '>= 1.0', '< 2.0'
21 changes: 21 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,35 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
coderay (1.1.3)
diff-lcs (1.5.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
method_source (1.0.0)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.8.2)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand All @@ -32,6 +51,8 @@ PLATFORMS
x64-mingw-ucrt

DEPENDENCIES
pry
rspec (~> 3.0)
rubocop (>= 1.0, < 2.0)

BUNDLED WITH
Expand Down
20 changes: 11 additions & 9 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require './book'
require './student'
require './teacher'
require './classes/book'
require './classes/student'
require './classes/teacher'
require './manager'

class App
Expand Down Expand Up @@ -28,7 +28,7 @@ def book_list
puts 'There is no book in the list'
else
@books.each_with_index do |book, index|
rentals_str = book['rentals'].join(', ') # Convert array to string
rentals_str = book['rentals'].join(', ')
puts "#{index} - Title: #{book['title'].capitalize}, " \
"Author: #{book['author'].capitalize} Rentals: #{rentals_str}"
end
Expand All @@ -40,7 +40,7 @@ def people_list
puts 'There is no people in the list'
else
@people.each_with_index do |person, index|
if person.key?('specialization')
if person.include?('specialization')
puts "#{index} [Teacher] Name: #{person['name']}, ID: #{person['id']}, Age: #{person['age']}"
else
puts "#{index} [Student] Name: #{person['name']}, ID: #{person['id']}, Age: #{person['age']}"
Expand All @@ -67,8 +67,9 @@ def teacher_create
name = get_user_input('Name:')
specialization = get_user_input('Specialization:')
parent_permission = true
@people << Teacher.new(age: age, name: name, specialization: specialization, parent_permission: parent_permission)
puts 'Person created successfully!'
teacher = Teacher.new(age: age, name: name, specialization: specialization, parent_permission: parent_permission)
@people << teacher
puts "Person created successfully! Added a #{teacher.class} to @people."
end

def student_create
Expand All @@ -77,8 +78,9 @@ def student_create
permission = get_user_input('Has parent permission? [y/n]').downcase
parent_permission = permission == 'y'
classroom = get_user_input('Classroom:')
@people << Student.new(age: age, name: name, parent_permission: parent_permission, classroom: classroom)
puts 'Person created successfully!'
student = Student.new(age: age, name: name, parent_permission: parent_permission, classroom: classroom)
@people << student
puts "Person created successfully! Added a #{student.class} to @people."
end

def new_book
Expand Down
23 changes: 0 additions & 23 deletions book.rb

This file was deleted.

7 changes: 0 additions & 7 deletions capitalize_decorator.rb

This file was deleted.

16 changes: 0 additions & 16 deletions classroom.rb

This file was deleted.

14 changes: 0 additions & 14 deletions decorator.rb

This file was deleted.

5 changes: 0 additions & 5 deletions nameable.rb

This file was deleted.

37 changes: 0 additions & 37 deletions person.rb

This file was deleted.

22 changes: 0 additions & 22 deletions rental.rb

This file was deleted.

33 changes: 0 additions & 33 deletions student.rb

This file was deleted.

22 changes: 0 additions & 22 deletions teacher.rb

This file was deleted.

7 changes: 0 additions & 7 deletions trimmer_decorator.rb

This file was deleted.

0 comments on commit b4df7a2

Please sign in to comment.