Skip to content

Commit

Permalink
initialize created and test green
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinByrne committed Jan 30, 2022
1 parent 7ac30b1 commit 64b888e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
14 changes: 5 additions & 9 deletions lib/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,19 @@ class Menu
Feta_sauce: 1.00,
}

attr_reader :order_choice
attr_reader :order_choice, :stock

def initialize
@stock = stock
@order_choice = Hash.new
end

def menu_dishes # defined method
MENU_LIST # calls items from CONSTANT above
end

def order(item, price) # order method defined, arguments must have an item and a price
order_choice[item] = price
end

end

order = Menu.new
p order.menu_dishes
p order.order_choice
# order = Menu.new
# p order.menu_dishes
# p order.order_choice

12 changes: 6 additions & 6 deletions spec/menu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

describe Menu do

subject(:menu){described_class.new}
describe 'initialize' do
it 'initialize blank hash for order choice' do
expect(subject.order_choice).to be_empty
end
end

it 'should give user a list of menu dishes' do
expect(subject.menu_dishes).to eq Menu::MENU_LIST
end

it 'should add selected items to selected list' do
order_choice = {:food => 6}
subject.order(:food, 6)
expect(subject.order_choice).to eq order_choice
end

end

0 comments on commit 64b888e

Please sign in to comment.