diff --git a/Gemfile b/Gemfile index fecd89c7..53857222 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.0.1' +gem 'rails', '~> 5.0.0' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets @@ -22,7 +22,7 @@ gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc # Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' +gem 'bcrypt', '~> 3.1.7' # Use Unicorn as the app server # gem 'unicorn' diff --git a/Gemfile.lock b/Gemfile.lock index c701ada1..23c88071 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,115 +1,124 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.0.1) - actionpack (= 5.0.0.1) - nio4r (~> 1.2) + actioncable (5.0.6) + actionpack (= 5.0.6) + nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) + actionmailer (5.0.6) + actionpack (= 5.0.6) + actionview (= 5.0.6) + activejob (= 5.0.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.0.1) - actionview (= 5.0.0.1) - activesupport (= 5.0.0.1) + actionpack (5.0.6) + actionview (= 5.0.6) + activesupport (= 5.0.6) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0.1) - activesupport (= 5.0.0.1) + actionview (5.0.6) + activesupport (= 5.0.6) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.0.1) - activesupport (= 5.0.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.6) + activesupport (= 5.0.6) globalid (>= 0.3.6) - activemodel (5.0.0.1) - activesupport (= 5.0.0.1) - activerecord (5.0.0.1) - activemodel (= 5.0.0.1) - activesupport (= 5.0.0.1) + activemodel (5.0.6) + activesupport (= 5.0.6) + activerecord (5.0.6) + activemodel (= 5.0.6) + activesupport (= 5.0.6) arel (~> 7.0) - activesupport (5.0.0.1) + activesupport (5.0.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) arel (7.1.4) - binding_of_caller (0.7.2) + bcrypt (3.1.11) + binding_of_caller (0.7.3) debug_inspector (>= 0.0.1) - builder (3.2.2) - byebug (9.0.6) + builder (3.2.3) + byebug (9.1.0) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) - concurrent-ruby (1.0.2) - debug_inspector (0.0.2) + coffee-script-source (1.12.2) + concurrent-ruby (1.0.5) + crass (1.0.3) + debug_inspector (0.0.3) erubis (2.7.0) execjs (2.7.0) - globalid (0.3.7) - activesupport (>= 4.1.0) - i18n (0.7.0) - jbuilder (2.6.0) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) - jquery-rails (4.2.1) + ffi (1.9.18) + globalid (0.4.1) + activesupport (>= 4.2.0) + i18n (0.9.1) + concurrent-ruby (~> 1.0) + jbuilder (2.7.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) + jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.3) - loofah (2.0.3) + json (1.8.6) + loofah (2.1.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.4) - mime-types (>= 1.16, < 4) - method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) - minitest (5.9.1) - multi_json (1.12.1) - nio4r (1.2.1) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - rack (2.0.1) + mail (2.7.0) + mini_mime (>= 0.1.1) + method_source (0.9.0) + mini_mime (1.0.0) + mini_portile2 (2.3.0) + minitest (5.10.3) + multi_json (1.12.2) + nio4r (2.1.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) + rack (2.0.3) rack-test (0.6.3) rack (>= 1.0) - rails (5.0.0.1) - actioncable (= 5.0.0.1) - actionmailer (= 5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) - activemodel (= 5.0.0.1) - activerecord (= 5.0.0.1) - activesupport (= 5.0.0.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.0.1) + rails (5.0.6) + actioncable (= 5.0.6) + actionmailer (= 5.0.6) + actionpack (= 5.0.6) + actionview (= 5.0.6) + activejob (= 5.0.6) + activemodel (= 5.0.6) + activerecord (= 5.0.6) + activesupport (= 5.0.6) + bundler (>= 1.3.0) + railties (= 5.0.6) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.1) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.0.0.1) - actionpack (= 5.0.0.1) - activesupport (= 5.0.0.1) + railties (5.0.6) + actionpack (= 5.0.6) + activesupport (= 5.0.6) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (11.3.0) - rdoc (4.2.2) - json (~> 1.4) - sass (3.4.22) - sass-rails (5.0.6) + rake (12.3.0) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rdoc (4.3.0) + sass (3.5.3) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) @@ -118,41 +127,42 @@ GEM sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - spring (2.0.0) + spring (2.0.2) activesupport (>= 4.2) - sprockets (3.7.0) + sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.12) - thor (0.19.1) - thread_safe (0.3.5) - tilt (2.0.5) - tzinfo (1.2.2) + sqlite3 (1.3.13) + thor (0.20.0) + thread_safe (0.3.6) + tilt (2.0.8) + tzinfo (1.2.4) thread_safe (~> 0.1) - uglifier (3.0.3) + uglifier (4.0.1) execjs (>= 0.3.0, < 3) web-console (2.3.0) activemodel (>= 4.0) binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) - websocket-driver (0.6.4) + websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) + websocket-extensions (0.1.3) PLATFORMS ruby DEPENDENCIES + bcrypt (~> 3.1.7) byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails - rails (~> 5.0) + rails (~> 5.0.0) sass-rails (~> 5.0) sdoc (~> 0.4.0) spring @@ -161,4 +171,4 @@ DEPENDENCIES web-console (~> 2.0) BUNDLED WITH - 1.11.2 + 1.16.0 diff --git a/app/assets/images/landing-image.jpg b/app/assets/images/landing-image.jpg new file mode 100644 index 00000000..1cf296a9 Binary files /dev/null and b/app/assets/images/landing-image.jpg differ diff --git a/app/assets/images/seat-yourself.png b/app/assets/images/seat-yourself.png new file mode 100644 index 00000000..1adaca1c Binary files /dev/null and b/app/assets/images/seat-yourself.png differ diff --git a/app/assets/images/seatyourself.png b/app/assets/images/seatyourself.png new file mode 100644 index 00000000..e7cd265f Binary files /dev/null and b/app/assets/images/seatyourself.png differ diff --git a/app/assets/javascripts/reservations.coffee b/app/assets/javascripts/reservations.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/reservations.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/restaurants.coffee b/app/assets/javascripts/restaurants.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/restaurants.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/sessions.coffee b/app/assets/javascripts/sessions.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/sessions.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/users.coffee b/app/assets/javascripts/users.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/users.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index f9cd5b34..00000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any styles - * defined in the other CSS/SCSS files in this directory. It is generally better to create a new - * file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss new file mode 100644 index 00000000..840cd132 --- /dev/null +++ b/app/assets/stylesheets/application.scss @@ -0,0 +1,68 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any styles + * defined in the other CSS/SCSS files in this directory. It is generally better to create a new + * file per style scope. + * + *= require_tree . + *= require_self + */ + .container-fluid{ + padding:0px; + font-family: 'Open Sans', sans-serif; + } + .row{ + margin:0; + } + + nav{ + border-radius:0px; + border-bottom: 1px solid black; + .btn-primary{ + color:white; + a{ + color:white; + } + } + .form-control{ + margin-top:6px; + } + .navbar-form{ + margin:0; + } + .navbar-text{ + margin-bottom:0px; + } + .dropdown{ + display:inline-block; + } + .navbar-brand{ + font-family: 'Pacifico', cursive; + padding: 0; + img{ + width:50px; + height:50px; + display:inline; + } + } + .navbar-right{ + margin-right:0px; + } + .btn{ + margin-top:8px; + margin-right:10px; + border: 1px solid black; + } + a{ + color:black; + } + a:hover{ + text-decoration:none; + } + } diff --git a/app/assets/stylesheets/reservations.scss b/app/assets/stylesheets/reservations.scss new file mode 100644 index 00000000..64d990d2 --- /dev/null +++ b/app/assets/stylesheets/reservations.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the reservations controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/restaurants.scss b/app/assets/stylesheets/restaurants.scss new file mode 100644 index 00000000..f38dc94a --- /dev/null +++ b/app/assets/stylesheets/restaurants.scss @@ -0,0 +1,6 @@ +// Place all the styles related to the restaurants controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +.restaurant { + padding: 20px; +} diff --git a/app/assets/stylesheets/sessions.scss b/app/assets/stylesheets/sessions.scss new file mode 100644 index 00000000..7bef9cf8 --- /dev/null +++ b/app/assets/stylesheets/sessions.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the sessions controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss new file mode 100644 index 00000000..d8e4c436 --- /dev/null +++ b/app/assets/stylesheets/users.scss @@ -0,0 +1,13 @@ +// Place all the styles related to the users controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +.profile-name{ + font-size:32px; +} +.vertical{ + margin-top:5px; +} +.reservation-text +{ + margin-bottom:0px; +} \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e1..1493ee50 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,20 @@ class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception + config.time_zone = 'Eastern Time (US & Canada)' + + def ensure_logged_in + unless current_user + flash[:alert] = "Please log in" + redirect_to new_sessions_url + end + end + + private + + def current_user + @current_user ||= User.find(session[:user_id]) if session[:user_id] + end + + helper_method :current_user end diff --git a/app/controllers/reservations_controller.rb b/app/controllers/reservations_controller.rb new file mode 100644 index 00000000..4656c595 --- /dev/null +++ b/app/controllers/reservations_controller.rb @@ -0,0 +1,84 @@ +class ReservationsController < ApplicationController + before_action :ensure_logged_in + before_action :load_reservation, only: [:show, :edit, :update, :destroy] + # before_action :ensure_user_owns_reservation, except: [:new, :create] + + def load_reservation + @reservation = Reservation.find(params[:id]) + end + + def ensure_user_owns_reservation + @reservations = Reservation.find_by(user_id: params[:user_id]) + unless current_user.id == @reservations.user_id + flash[:alert] = "Please log in" + redirect_to new_sessions_url + end + end + + def index + @reservations = Reservation.find_by(user_id: params[:user_id]) + end + + def show + end + + def new + @user = current_user + @restaurants = Restaurant.all + @reservation = Reservation.new + end + + def create + @restaurant = Restaurant.find(params[:restaurant_id]) + @reservation = Reservation.new + @reservation.user_id = current_user.id + @reservation.restaurant_id = @restaurant.id + @reservation.date_time = Time.utc(params[:reservation]["date_time(1i)"].to_i, + params[:reservation]["date_time(2i)"].to_i, + params[:reservation]["date_time(3i)"].to_i, + params[:reservation]["date_time(4i)"].to_i, + params[:reservation]["date_time(5i)"].to_i) + @reservation.party_size = params[:reservation][:party_size] + if @reservation.save + + flash[:notice] = "Reservation was successfully booked!" + redirect_to users_url + else + render "restaurants/show" + flash[:notice] = @reservation.errors.full_messages.each { |error| puts "#{error.to_s}"} + + end + end + + def edit + @user = current_user + @restaurant = @reservation.restaurant + @restaurants = Restaurant.all + end + + def update + @restaurant = Restaurant.find(params[:restaurant_id]) + @reservation.user_id = current_user.id + @reservation.restaurant_id = @restaurant.id + @reservation.date_time = Time.utc(params[:reservation]["date_time(1i)"].to_i, + params[:reservation]["date_time(2i)"].to_i, + params[:reservation]["date_time(3i)"].to_i, + params[:reservation]["date_time(4i)"].to_i, + params[:reservation]["date_time(5i)"].to_i) + @reservation.party_size = params[:reservation][:party_size] + if @reservation.save + flash[:notice] = "Reservation was successfully updated!" + redirect_to users_url + else + render :edit + flash[:notice] = @reservation.errors.full_messages + end + end + + def destroy + @reservation.destroy + flash[:notice] = "You have canceled your reservation" + redirect_to users_url + end + +end diff --git a/app/controllers/restaurants_controller.rb b/app/controllers/restaurants_controller.rb new file mode 100644 index 00000000..a4c662b8 --- /dev/null +++ b/app/controllers/restaurants_controller.rb @@ -0,0 +1,84 @@ +class RestaurantsController < ApplicationController +before_action :ensure_logged_in, except: [:index, :show] +before_action :load_restaurant, only: [:show, :edit, :update, :destroy] +before_action :ensure_user_owns_restaurant, only: [:edit, :update, :destroy] + + + def load_restaurant + @restaurant = Restaurant.find(params[:id]) + end + + def ensure_user_owns_restaurant + unless current_user == @restaurant.user + flash[:alert] = "Please log in" + redirect_to new_sessions_url + end + end + + def search_params + params.require(:search).permit(:name, :cuisine) + end + + + def index + @restaurants = if params[:search] + Restaurant.where('name Like ?', "%#{params[:search]}%").or(Restaurant.where('cuisine Like ?', "%#{params[:search]}%")).or(Restaurant.where('address Like ?', "%#{params[:search]}%")) + else + Restaurant.all + end + + end + + def show + @user = current_user + @restaurants = Restaurant.all + @reservation = Reservation.new + @reservations = @restaurant.reservations + end + + def new + @restaurant = Restaurant.new + end + + def create + @restaurant = Restaurant.new + @restaurant.name = params[:restaurant][:name] + @restaurant.address = params[:restaurant][:address] + @restaurant.capacity = params[:restaurant][:capacity] + @restaurant.close_time = params[:restaurant][:close_time] + @restaurant.open_time = params[:restaurant][:open_time] + @restaurant.user_id = params[:restaurant][:user_id] + + if @restaurant.save + redirect_to restaurants_url + else + render :new + end + + end + + def edit + end + + def update + @restaurant.name = params[:restaurant][:name] + @restaurant.address = params[:restaurant][:address] + @restaurant.capacity = params[:restaurant][:capacity] + @restaurant.close_time = params[:restaurant][:close_time] + @restaurant.open_time = params[:restaurant][:open_time] + @restaurant.user_id = params[:restaurant][:user_id] + + if @restaurant.save + redirect_to restaurants_url + else + render :new + end + + end + + def destroy + @restaurant.destroy + redirect_to restaurants_url + end + +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 00000000..129632cd --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,23 @@ +class SessionsController < ApplicationController + +def new +end + +def create + user = User.find_by(email: params[:email]) + if user && user.authenticate(params[:password]) + session[:user_id] = user.id + redirect_to users_url(user) + # redirect_to user_reservations_url(user.id), notice: "Logged in!" + else + flash.alert = "Incorrect login. Please try again." + render :new + end +end + +def destroy + session[:user_id] = nil + redirect_to restaurants_url, notice: "Logged out" +end + +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 00000000..121f9051 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,54 @@ +class UsersController < ApplicationController + before_action :ensure_logged_in, except: [:new, :create] + + def new + @user = User.new + end + + def show + @user = current_user + @restaurants = Restaurant.all + @reservations = Reservation.all + + end + + def edit + @user = current_user + end + + def create + @user = User.new + + @user.name = params[:user][:name] + @user.email = params[:user][:email] + @user.password = params[:user][:password] + @user.password_confirmation = params[:user][:password_confirmation] + + if @user.save + user = User.find_by(email: params[:user][:email]) + session[:user_id] = user.id + redirect_to root_url + else + render :new + end + end + + def update + @user = current_user + + @user.name = params[:user][:name] + @user.email = params[:user][:email] + + if @user.save + redirect_to users_url + else + render :edit + end + end + + def destroy + @user = current_user + @user.destroy + redirect_to new_users_url + end +end diff --git a/app/helpers/reservations_helper.rb b/app/helpers/reservations_helper.rb new file mode 100644 index 00000000..f28b699d --- /dev/null +++ b/app/helpers/reservations_helper.rb @@ -0,0 +1,2 @@ +module ReservationsHelper +end diff --git a/app/helpers/restaurants_helper.rb b/app/helpers/restaurants_helper.rb new file mode 100644 index 00000000..3937c4c7 --- /dev/null +++ b/app/helpers/restaurants_helper.rb @@ -0,0 +1,2 @@ +module RestaurantsHelper +end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb new file mode 100644 index 00000000..309f8b2e --- /dev/null +++ b/app/helpers/sessions_helper.rb @@ -0,0 +1,2 @@ +module SessionsHelper +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 00000000..2310a240 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/models/reservation.rb b/app/models/reservation.rb new file mode 100644 index 00000000..054f97a0 --- /dev/null +++ b/app/models/reservation.rb @@ -0,0 +1,49 @@ +class Reservation < ApplicationRecord + belongs_to :user + belongs_to :restaurant + + validates :user_id, :restaurant_id, :date_time, :party_size, presence: :true + validates :party_size, numericality: {only_integer: true} + validate :date_cannot_be_in_past + validate :availability + + def date_cannot_be_in_past + errors.add(:date_time, "can't be in the past") if date_time < Time.now + end + + + def availability + # puts "!!!! #{self.inspect} !!!!" + restaurant = Restaurant.find_by(id: restaurant_id) + if restaurant + group_time = 0 + capacity = restaurant.capacity.to_i + reservations = Reservation.where( restaurant_id: restaurant_id) + if date_time.hour <= restaurant.close_time.hour && date_time.hour >= restaurant.open_time.hour + reservations.each do |reservation| + dt = reservation.date_time + if dt.day == date_time.day && dt.month == date_time.month && dt.year == date_time.year + reservation.party_size.times do + group_time += 0.25 + end + if dt.hour >= date_time.hour - group_time && dt.hour <= date_time.hour + group_time + capacity -= reservation.party_size + end + end + end + + if capacity >= party_size + return true + else + errors.add(:party_size, "Request exceeds Restaurant capacity") + end + + else + errors.add(:date_time, "Restaurant closed for that time") + end + end + + end + + +end diff --git a/app/models/restaurant.rb b/app/models/restaurant.rb new file mode 100644 index 00000000..b0ab2d9f --- /dev/null +++ b/app/models/restaurant.rb @@ -0,0 +1,18 @@ +class Restaurant < ApplicationRecord + has_many :reservations + belongs_to :user + + validates :capacity, :name, :close_time, :open_time, :user_id, :address, :cuisine, presence: :true + validates :capacity, numericality: {only_integer: true} + + def self.search(search) + if search + find(:all, :conditions => ['name LIKE ?', "%#{search}%"]) + else + find(:all) + end +end + + + +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 00000000..de1a9bda --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,8 @@ +class User < ApplicationRecord + has_many :reservations + has_many :restaurants + + has_secure_password + validates :email, :name, presence: :true + validates :email, uniqueness: :true +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c32feae9..ffeb5cb6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,58 @@ - Seatyourself - <%= stylesheet_link_tag 'application', media: 'all' %> - <%= javascript_include_tag 'application' %> - <%= csrf_meta_tags %> + Seatyourself + <%= javascript_include_tag 'application' %> + <%= csrf_meta_tags %> + + + <%= stylesheet_link_tag 'application', media: 'all' %> + +
+ + + + <% if flash[:notice] %> +

<%= flash[:notice]%>

+ <% end %> + <% if flash[:alert] %> +

<%= flash[:alert] %>

+ <% end %> + <%= yield %> +
diff --git a/app/views/reservations/_form.html.erb b/app/views/reservations/_form.html.erb new file mode 100644 index 00000000..c3c1bed1 --- /dev/null +++ b/app/views/reservations/_form.html.erb @@ -0,0 +1,12 @@ +<%= form_for([restaurant, reservation]) do |f|%> + <%= f.label :party_size %> + <%= f.text_field :party_size%> + <%= f.label :Reservation_date %> + <%= f.datetime_select :date_time, + :start_year => Date.current.year, + :end_year => Date.current.year + 1, + :default => Time.now, + :ampm => true, + :minute_step =>15 %> +<%= f.submit %> +<% end %> diff --git a/app/views/reservations/_form_for_restaurant.html.erb b/app/views/reservations/_form_for_restaurant.html.erb new file mode 100644 index 00000000..9bde0f5d --- /dev/null +++ b/app/views/reservations/_form_for_restaurant.html.erb @@ -0,0 +1,15 @@ +<%= form_for([restaurant, reservation], url: restaurant_reservation_path) do |f|%> + <%= f.label :Restaurant %> + <%= f.collection_select :restaurant_id, @restaurants, :id, :name, prompt:true, :selected => params[:id] %> + <%= f.label :party_size %> + <%= f.text_field :party_size%> + <%= f.label :Reservation_date %> + <%= f.datetime_select :date_time, + :start_year => Date.current.year, + :end_year => Date.current.year + 1, + :default => Time.now, + :ampm => true, + :minute_step =>15 %> + <% f.text_field :user_id, :selected => current_user.id %> +<%= f.submit %> +<% end %> diff --git a/app/views/reservations/edit.html.erb b/app/views/reservations/edit.html.erb new file mode 100644 index 00000000..3ca1f3c0 --- /dev/null +++ b/app/views/reservations/edit.html.erb @@ -0,0 +1,3 @@ +

Edit Reservation

+ +<%= render 'reservations/form', restaurant: @restaurant, reservation: @reservation %> diff --git a/app/views/reservations/index.html.erb b/app/views/reservations/index.html.erb new file mode 100644 index 00000000..93cf951a --- /dev/null +++ b/app/views/reservations/index.html.erb @@ -0,0 +1,14 @@ +

Here are your Reservations, <%= current_user.name %>

+ +<% reservations = Reservation.where( user_id: current_user.id) %> + diff --git a/app/views/reservations/new.html.erb b/app/views/reservations/new.html.erb new file mode 100644 index 00000000..55235615 --- /dev/null +++ b/app/views/reservations/new.html.erb @@ -0,0 +1,16 @@ +

Make a new reservation

+ +<%= form_for([@user, @reservation], url: users_reservations_path) do |f|%> + <%= f.label :Restaurant %> + <%= f.collection_select :restaurant_id, @restaurants, :id, :name, prompt:true, :selected =>params[:id] %> + <%= f.label :party_size %> + <%= f.text_field :party_size%> + <%= f.label :Reservation_date %> + <%= f.datetime_select :date_time, + :start_year => Date.current.year, + :end_year => Date.current.year + 1, + :default => Time.now, + :ampm => true, + :minute_step =>15 %> +<%= f.submit %> +<% end %> diff --git a/app/views/reservations/show.html.erb b/app/views/reservations/show.html.erb new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/app/views/reservations/show.html.erb @@ -0,0 +1 @@ + diff --git a/app/views/restaurants/_restaurant_form.html.erb b/app/views/restaurants/_restaurant_form.html.erb new file mode 100644 index 00000000..99625af6 --- /dev/null +++ b/app/views/restaurants/_restaurant_form.html.erb @@ -0,0 +1,44 @@ +<%= form_for @restaurant do |f|%> +

+ <%= f.label :name %> + <%= f.text_field :name %> +

+

+ <%= f.label :name %> + <%= f.text_field :name %> +

+

+ <%= f.label :address %> + <%= f.text_field :address%> +

+

+ <%= f.label :capacity %> + <%= f.text_field :capacity%> +

+

+ <%= f.label :open_time %> + <%= f.time_field :open_time%> +

+

+ <%= f.label :close_time %> + <%= f.time_field :close_time%> +

+

+ <%= f.label :user_id %> + <%= f.text_field :user_id%> +

+

+ <%= f.submit %> +

+ <% if restaurant.errors.any? %> +
+

<%= pluralize(restaurant.errors.count, "error") %> prohibited this product from being saved:

+ +
    + <% restaurant.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> +<% end %> diff --git a/app/views/restaurants/_single_restaurant.html.erb b/app/views/restaurants/_single_restaurant.html.erb new file mode 100644 index 00000000..c9566fc2 --- /dev/null +++ b/app/views/restaurants/_single_restaurant.html.erb @@ -0,0 +1,8 @@ +
+

<%= link_to restaurant.name, restaurant_path(restaurant)%>

+

<%= restaurant.cuisine %>

+ <%= image_tag(restaurant.image_url) %> +

Open <%= restaurant.open_time.strftime("%l:%M %p")%> to <%= restaurant.close_time.strftime("%l:%M %p")%>

+ + +
diff --git a/app/views/restaurants/edit.html.erb b/app/views/restaurants/edit.html.erb new file mode 100644 index 00000000..190dc972 --- /dev/null +++ b/app/views/restaurants/edit.html.erb @@ -0,0 +1,5 @@ +

Edit Restaurant

+ +<%= link_to("Back", restaurant_path) %> + +<%= render 'restaurant_form', restaurant: @restaurant %> diff --git a/app/views/restaurants/index.html.erb b/app/views/restaurants/index.html.erb new file mode 100644 index 00000000..140b11e3 --- /dev/null +++ b/app/views/restaurants/index.html.erb @@ -0,0 +1,12 @@ + +

Restaurants

+
+<% if current_user != nil %> + <%= link_to "See Reservations", users_path(:id) %> + <%end %> +
+ +<% @restaurants.each do |current_restaurant| %> + <%= render 'single_restaurant', restaurant: current_restaurant %> +<% end %> +<%= link_to("New Restaurant", new_restaurant_path)%> diff --git a/app/views/restaurants/new.html.erb b/app/views/restaurants/new.html.erb new file mode 100644 index 00000000..77f948bc --- /dev/null +++ b/app/views/restaurants/new.html.erb @@ -0,0 +1,4 @@ +

New Restaurant

+<%= link_to("Back", restaurants_path) %> + +<%= render 'restaurant_form', restaurant: @restaurant %> diff --git a/app/views/restaurants/show.html.erb b/app/views/restaurants/show.html.erb new file mode 100644 index 00000000..078b611d --- /dev/null +++ b/app/views/restaurants/show.html.erb @@ -0,0 +1,25 @@ +<%= link_to("Back", restaurants_path) %> + +<%= render 'restaurants/single_restaurant', restaurant: @restaurant %> + +<% if current_user != nil %> + <% if current_user.id == @restaurant.user_id %> + <%= link_to("Edit", edit_restaurant_url(@restaurant.id)) %> + <%if @reservations %> + <% @reservations.each do |reservation| %> + + <%end %> + <% end %> + <%end %> +
+<% end %> + + +

Make a reservation

+ + +<%= render 'reservations/form', restaurant: @restaurant, reservation: @reservation %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 00000000..d60fd24c --- /dev/null +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,15 @@ +

Log In

+ +<%= form_tag sessions_path do %> +
+ <%= label_tag :email %>
+ <%= text_field_tag :email, params[:email] %> +
+
+ <%= label_tag :password %>
+ <%= password_field_tag :password, params[:password] %> +
+
<%= submit_tag "Log in" %> + +
+<%end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 00000000..478ffbac --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,11 @@ +<%= form_for @user, url: users_url(@user) do |f|%> +
+ <%= f.label :name %> + <%= f.text_field :name %> +
+
+ <%= f.label :email %> + <%= f.email_field :email %> +
+ <%= f.submit %> +<% end %> diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 00000000..dc3ea966 --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,36 @@ + +

Signup Form

+ +<%= form_for @user do |f|%> +
+ <%= f.label :name %> + <%= f.text_field :name %> +
+
+ <%= f.label :email %> + <%= f.email_field :email %> +
+
+ <%= f.label :password %> + <%= f.password_field :password %> +
+
+ <%= f.label :password_confirmation %> + <%= f.password_field :password_confirmation %> +
+ <%= f.submit %> + <%end %> + + <% if @user.errors.any? %> +

Error

+
+

<%= pluralize(@user.errors.count, "error") %> prohibited this product from being saved:

+ +
    + <% @user.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> +
\ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 00000000..e7a75e80 --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,30 @@ + +
+
+ <%= @user.name.capitalize%> +
+
+ <%= link_to("Edit Profile", edit_users_path, :class => "btn btn-success")%> +
+
+ +
+
+

Reservations

+
+ +
+ +
+ <% reservations = Reservation.where( user_id: @user.id) %> + <% reservations.each do |reservation| %> +
+ <%= "You have a reservation at #{reservation.restaurant.name} on #{reservation.date_time.strftime("%A, %B %-d at %l:%M %P")} for #{reservation.party_size} people" %> +
+ <%= link_to("Edit", edit_restaurant_reservation_url(reservation.restaurant_id, reservation)) %> + | <%= link_to("Delete", restaurant_reservation_url(reservation.restaurant_id, reservation), method: :delete, data: {confirm: "Are you sure?"}) %> +
+ + <%end %> +
+ diff --git a/config/routes.rb b/config/routes.rb index 787824f8..4afdaed4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,11 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + resource :users, except: :index + resources :restaurants do + resources :reservations + end + + resource :sessions, only: [:new, :create, :destroy] + root to: 'restaurants#index' + end diff --git a/db/migrate/20171204202006_create_users.rb b/db/migrate/20171204202006_create_users.rb new file mode 100644 index 00000000..9e6ab64d --- /dev/null +++ b/db/migrate/20171204202006_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration[5.0] + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :password_digest + + t.timestamps + end + end +end diff --git a/db/migrate/20171204202322_create_reservations.rb b/db/migrate/20171204202322_create_reservations.rb new file mode 100644 index 00000000..8e8921e3 --- /dev/null +++ b/db/migrate/20171204202322_create_reservations.rb @@ -0,0 +1,12 @@ +class CreateReservations < ActiveRecord::Migration[5.0] + def change + create_table :reservations do |t| + t.integer :user_id + t.integer :restaurant_id + t.datetime :date_time + t.integer :party_size + + t.timestamps + end + end +end diff --git a/db/migrate/20171204202425_create_restaurants.rb b/db/migrate/20171204202425_create_restaurants.rb new file mode 100644 index 00000000..f299663b --- /dev/null +++ b/db/migrate/20171204202425_create_restaurants.rb @@ -0,0 +1,14 @@ +class CreateRestaurants < ActiveRecord::Migration[5.0] + def change + create_table :restaurants do |t| + t.integer :capacity + t.string :address + t.string :name + t.time :close_time + t.time :open_time + t.integer :user_id + + t.timestamps + end + end +end diff --git a/db/migrate/20171204211120_change_time_to_date_time.rb b/db/migrate/20171204211120_change_time_to_date_time.rb new file mode 100644 index 00000000..d00bc724 --- /dev/null +++ b/db/migrate/20171204211120_change_time_to_date_time.rb @@ -0,0 +1,6 @@ +class ChangeTimeToDateTime < ActiveRecord::Migration[5.0] + def change + change_column :restaurants, :close_time, :datetime + change_column :restaurants, :open_time, :datetime + end +end diff --git a/db/migrate/20171205202152_add_cuisine_type.rb b/db/migrate/20171205202152_add_cuisine_type.rb new file mode 100644 index 00000000..8a3b4b81 --- /dev/null +++ b/db/migrate/20171205202152_add_cuisine_type.rb @@ -0,0 +1,6 @@ +class AddCuisineType < ActiveRecord::Migration[5.0] + def change + add_column :restaurants, :cuisine, :string + add_column :restaurants, :rating, :integer + end +end diff --git a/db/migrate/20171206040706_add_picture_to_restaurant.rb b/db/migrate/20171206040706_add_picture_to_restaurant.rb new file mode 100644 index 00000000..1a1c7a9e --- /dev/null +++ b/db/migrate/20171206040706_add_picture_to_restaurant.rb @@ -0,0 +1,5 @@ +class AddPictureToRestaurant < ActiveRecord::Migration[5.0] + def change + add_column :restaurants, :image_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 00000000..6ed4ab26 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,46 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20171206040706) do + + create_table "reservations", force: :cascade do |t| + t.integer "user_id" + t.integer "restaurant_id" + t.datetime "date_time" + t.integer "party_size" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "restaurants", force: :cascade do |t| + t.integer "capacity" + t.string "address" + t.string "name" + t.datetime "close_time" + t.datetime "open_time" + t.integer "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "cuisine" + t.integer "rating" + t.string "image_url" + end + + create_table "users", force: :cascade do |t| + t.string "name" + t.string "email" + t.string "password_digest" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e85..64b95e39 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,23 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) +User.destroy_all +Restaurant.destroy_all +Reservation.destroy_all +User.create!(name: "brandon", email: "brandon@brandon.com" , password_digest: "123456", password: "123456", password_confirmation: "123456") +User.create!(name: "eric", email: "eric@eric.com" , password_digest: "123456", password: "123456", password_confirmation: "123456") +User.create!(name: "william", email: "will@will.com" , password_digest: "123456", password: "123456", password_confirmation: "123456") +User.create!(name: "sharon", email: "share@share.com" , password_digest: "123456", password: "123456", password_confirmation: "123456") + +t = Time.new(2017, 10, 10, 17, 0,0, "+00:00") +t2 = t + 5.hours +Restaurant.create!(name: "Los Colibris", address:" 220 King St W", capacity: "20", open_time: t, close_time: t2, user_id:1, cuisine: "Mexican", image_url: 'http://www.blogto.com/listings/restaurants/upload/2014/06/20140605-loscolibris590-10.jpg') +Restaurant.create!(name: "Pai", address:" 18 Duncan St", capacity: "20", open_time: t, close_time: t2, user_id:2, cuisine: "Thai", image_url: 'https://media-cdn.tripadvisor.com/media/photo-s/07/f4/c9/7b/pai-northern-thai-kitchen.jpg') +Restaurant.create!(name: "The Keg", address:" 560 King St W", capacity: "20", open_time: t, close_time: t2, user_id:3, cuisine: "Steakhouse", image_url: 'http://www.emeraldhillscentre.com/wp-content/uploads/2016/11/the-Keg.jpg') +Restaurant.create!(name: "The Loose Moose", address:" 146 Front St W", capacity: "20", open_time: t, close_time: t2, user_id:4, cuisine: "Canadian", image_url: 'http://www.sircorp.com/files/last/loose-moose_img-big-930.jpg') +Restaurant.create!(name: "Byblos", address: "11 Duncan St", capacity: "20", open_time: t, close_time: t2, user_id:1, cuisine:"Mediterranean", image_url: 'http://www.blogto.com/listings/restaurants/upload/2014/03/20140313-byblos590-05.jpg') + +Reservation.create!(user_id: 1, restaurant_id: 1, date_time: t, party_size: 5) +Reservation.create!(user_id: 2, restaurant_id: 2, date_time: t, party_size: 5) +Reservation.create!(user_id: 3, restaurant_id: 3, date_time: t, party_size: 5) +Reservation.create!(user_id: 4, restaurant_id: 4, date_time: t, party_size: 5) diff --git a/test/controllers/reservations_controller_test.rb b/test/controllers/reservations_controller_test.rb new file mode 100644 index 00000000..3b4d21b6 --- /dev/null +++ b/test/controllers/reservations_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ReservationsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/restaurants_controller_test.rb b/test/controllers/restaurants_controller_test.rb new file mode 100644 index 00000000..861f6275 --- /dev/null +++ b/test/controllers/restaurants_controller_test.rb @@ -0,0 +1,39 @@ +require 'test_helper' + +class RestaurantsControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get restaurants_index_url + assert_response :success + end + + test "should get show" do + get restaurants_show_url + assert_response :success + end + + test "should get new" do + get restaurants_new_url + assert_response :success + end + + test "should get create" do + get restaurants_create_url + assert_response :success + end + + test "should get edit" do + get restaurants_edit_url + assert_response :success + end + + test "should get update" do + get restaurants_update_url + assert_response :success + end + + test "should get destroy" do + get restaurants_destroy_url + assert_response :success + end + +end diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb new file mode 100644 index 00000000..6135ce6a --- /dev/null +++ b/test/controllers/sessions_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SessionsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb new file mode 100644 index 00000000..6c3da770 --- /dev/null +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UsersControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/fixtures/reservations.yml b/test/fixtures/reservations.yml new file mode 100644 index 00000000..35369ddf --- /dev/null +++ b/test/fixtures/reservations.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + user_id: 1 + restaurant_id: 1 + date_time: 2017-12-04 15:23:22 + party_size: 1 + +two: + user_id: 1 + restaurant_id: 1 + date_time: 2017-12-04 15:23:22 + party_size: 1 diff --git a/test/fixtures/restaurants.yml b/test/fixtures/restaurants.yml new file mode 100644 index 00000000..c696833f --- /dev/null +++ b/test/fixtures/restaurants.yml @@ -0,0 +1,17 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + capacity: 1 + address: MyString + name: MyString + close_time: 2017-12-04 15:24:25 + open_time: 2017-12-04 15:24:25 + user_id: 1 + +two: + capacity: 1 + address: MyString + name: MyString + close_time: 2017-12-04 15:24:25 + open_time: 2017-12-04 15:24:25 + user_id: 1 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 00000000..67a68443 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + email: MyString + password_digest: MyString + +two: + name: MyString + email: MyString + password_digest: MyString diff --git a/test/models/reservation_test.rb b/test/models/reservation_test.rb new file mode 100644 index 00000000..391559fd --- /dev/null +++ b/test/models/reservation_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ReservationTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/restaurant_test.rb b/test/models/restaurant_test.rb new file mode 100644 index 00000000..b45b7417 --- /dev/null +++ b/test/models/restaurant_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class RestaurantTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 00000000..82f61e01 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end