Skip to content

Instantly share code, notes, and snippets.

@ps-97
Created July 7, 2023 11:05
Show Gist options
  • Save ps-97/d7c8d62b7362108eee98f6cb4b10a7ab to your computer and use it in GitHub Desktop.
Save ps-97/d7c8d62b7362108eee98f6cb4b10a7ab to your computer and use it in GitHub Desktop.
Bookstore Unit Testing
# bookstore_spec.rb
require 'rspec'
class Bookstore
attr_reader :books
def initialize
@books = []
end
def add_book(book)
@books << book
end
def total_price
end
def book_titles
end
def find_books_by_author(author)
end
def cheapest_book
end
end
class Book
attr_reader :title, :author, :price
def initialize(title, author, price)
@title = title
@author = author
@price = price
end
end
RSpec.describe Bookstore do
describe '#add_book' do
end
describe '#total_price' do
end
describe '#book_titles' do
end
describe '#find_books_by_author' do
end
describe '#cheapest_book' do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment