Skip to content

Commit

Permalink
add tests for a-6
Browse files Browse the repository at this point in the history
  • Loading branch information
shaina33 committed Dec 15, 2017
1 parent 3db411c commit 59f8d28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions controllers/menu_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize
end

def main_menu
puts "#{@address_book.name} Address Book Selected\n#{@address_book.entries.count} entries"
puts "'#{@address_book.name}' Address Book Selected\n#{@address_book.entries.count} entries"
puts "0 - Switch AddressBook"
puts "1 - View all entries"
puts "2 - Create an entry"
Expand Down Expand Up @@ -144,6 +144,9 @@ def entry_submenu(entry)
when "n"
when "d"
delete_entry(entry)
system "clear"
puts "#{entry.name} has been deleted"
main_menu
when "e"
edit_entry(entry)
entry_submenu(entry)
Expand All @@ -158,8 +161,7 @@ def entry_submenu(entry)
end

def delete_entry(entry)
address_book.entries.delete(entry)
puts "#{entry.name} has been deleted"
Entry.destroy(entry.id)
end

def edit_entry(entry)
Expand Down Expand Up @@ -253,6 +255,10 @@ def test_function
# Entry.destroy(2,3)
# Entry.first.destroy
# Entry.destroy_all(name: 'Jane')
# Entry.destroy_all
# Entry.destroy_all("phone_number = '999-999-9999'")
# Entry.destroy_all("phone_number = ?", '111-111-1111')
# Entry.where(name: 'Sally').destroy_all

# puts "output is: "
# puts output
Expand Down
Binary file modified db/address_bloc.sqlite
Binary file not shown.

0 comments on commit 59f8d28

Please sign in to comment.