Skip to content
This repository was archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
Book table in data base adding new requests
Browse files Browse the repository at this point in the history
  • Loading branch information
mavesonzini committed Dec 15, 2016
1 parent f4ec43e commit 0a11b8c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/models/book.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class Book
property :id, Serial
property :date, String, required: true


belongs_to :renter
belongs_to :listing

Expand Down
2 changes: 1 addition & 1 deletion app/vradbnb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class VRADBnB < Sinatra::Base

post '/booking/:id' do
listing = Listing.first(params[:id])
book = Book.new(date: params[:date], renter: current_renter, listing: listing)
book = Book.create(date: params[:date], renter: current_renter, listing: listing)
redirect to('/listings')
end

Expand Down
2 changes: 1 addition & 1 deletion spec/features/requests/booking_a_space_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
feature "bookinging a space" do

scenario "user books crack house for 15/12/2016" do
expect{ book_a_place }.to change(Owner, :count).by(1)
expect{ book_a_place }.to change(Book, :count).by(1)
expect(current_path).to eq('/listings')
end

Expand Down

0 comments on commit 0a11b8c

Please sign in to comment.