Skip to content

CraftAcademy/ufoods

Repository files navigation

Coverage Status Build Status Heroku

Ufoods app

August 2017 Craft Academy Course Project

An app which allows users to order food from various restaurants nearby.

Website

https://ufoods.herokuapp.com/

Using the site

As a customer:

Visit the Ufoods site. You will see restaurants nearby as markers on a map, and you may choose what range you want to search for restaurants in. You can choose a restaurant category, then a restaurant, then a menu, and then you can view different dishes. You sign up by creating an account with an email and password. After logging in you will be allowed to add dishes to order. On checkout you can choose delivery and pay with Stripe.

As a restaurant owner:

Visit the admin login site. You can sign up and get your restaurant registered. Once you've done that you can add info, menus and dishes.

As a superadmin:

Visit the admin login site. You can perform CRUD actions on all objects in the system. You are the one that registers Restaurant Owners and Restaurants.

Getting Started

Change the current working directory to the location where you want the cloned directory to be made.

$ git clone https://github.com/CraftAcademy/ufoods

Prerequisites

  • ruby 2.4.0
  • ruby rails 5.1.4

Installing

Ensure that the gem versions on your local machine are as specified in the Gemfile. Run bundle install to install dependencies.

Running the tests

Run rake to see all the tests pass.

For acceptance test we use Cucumber.

It runs automated acceptance tests written in a behavior-driven development (BDD) style. Central to the Cucumber BDD approach is its plain language parser called Gherkin. It allows expected software behaviors to be specified in a logical language that customers can understand.

Cucumber example:

Feature: user can see dishes and their info
  As a user
  In order to get food
  I would like to see a list of dishes and info about them

  Background:
    Given the following dishes exists
      | name           | description           | price  |  pic_url                |
      | Sushi rolls    | Tasty Japanese food   | 10     |  https://goo.gl/fH7P5F  |

  Scenario: user can view dish names
    Given I visit the dish page
    Then I should see the text "Sushi rolls"
    And I should see the text "Tasty Japanese food"
    And I should see the text "10"
    And I should see the picture "https://goo.gl/fH7P5F"

For unit tests we use Rspec

It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development(TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring.

Rspec example:

RSpec.describe Dish, type: :model do
  describe 'DB table' do
    it { is_expected.to have_db_column :name }
    it { is_expected.to have_db_column :description }
    it { is_expected.to have_db_column :price }
    it { is_expected.to have_db_column :pic_url }
  end

  describe 'Validations' do
    it { is_expected.to validate_presence_of :name }
    it { is_expected.to validate_presence_of :description }
    it { is_expected.to validate_presence_of :price }
    it { is_expected.to validate_presence_of :pic_url }
  end

  describe 'Factory' do
    it 'should be valid' do
      expect(FactoryGirl.create(:dish)).to be_valid
    end
  end
end

Deployment

We automatically deploy this app with Heroku through Github and Semaphore.

Built With

Main Gems and Helpers

Development Gems

Testing Gems

Authors

License

MIT license

Acknowledgments

The entire project is comprised of open source code so a huge THANKS to the open source community. Built with help from the coaches and some cool gems.

About

Camp August 2017 Slowfood Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published