A mini e-commerce application built with Rails 4.2 for purposes of teaching Rails by example. This project was built to emulate the real world, being dropped into an unfamiliar codebase where we don't already know the language. We needed to learn how to use Rails as well as recognizing what the code was doing in a large file structure. New features, bug fixes, and automated testing with RSpec and Capybara were implemented.
- Ruby on Rails
- Active Record (PSQL)
- CSS (Bootstrap)
- RSpec
- Capybara
- Sold Out Badge - If product quantity is less than 0, a sold out badge is added and "Add to cart" is disabled.
- Admin Categories - Administrators can add new product categories.
- User Authentication - Users can sign up or log in to save payment information and purchase history.
- Order Details Page (Enhancement) - Order details can be viewed, purchase email is displayed and users receive a confirmation email about their purchase.
- About Page - An about page has been added for the site.
- Automated Testing - Testing for product model and user authentication has been added with RSpec and Capybara.
- Styling - All forms and alerts have been styled for presentation.
- Missing Admin Security - Administrators need to log in before viewing admin dashboard, products, or categories pages. New items cannot be added unless logged in as an administrator.
- Empty Cart - If there are no items in the cart the user receives an error notice and link to the product page so they can add items to the cart.
- Inconsistent Money Display - Dollar amounts are displayed across the site instead of cents.
Users can view all available products on the home page. Sold out products have a sold out badge and disabled add button.
Users can register to use the site if they want to save their purchase history. They can also login on future visits
If users want to know more about Jungle, they can visit the About Us page.
Administrators have access to an Admin Dashboard displaying product and category counts, as well as links to the pages.
Administrators can also view a products and categories page where they can add new products or categories, and remove products if needed.
Users receive an error message and link to home page if there is nothing in the cart, and can view product details if items are being purchased.
- Rails 4.2 Rails Guide
- PostgreSQL 9.x PSQL 9.0 docs
- Stripe Stripe
- See
Gemfile
for gem dependencies
Log into Postgres as superuser:
sudo -u postgres psql
<br
Create the development database:
CREATE USER jungle_development WITH NOSUPERUSER PASSWORD 'development';
CREATE DATABASE jungle_devlopment OWNER jungle_development;
GRANT ALL ON DATABASE jungle_devlopment TO jungle_development;
- Project setup:
cd <project-directory>
git clone git@github.com:kelsi2/jungle.git
cd jungle
bundle install
- Create config/database.yml by copying config/database.example.yml.
- Create config/secrets.yml by copying config/secrets.example.yml.
- These files should be modified to match your database credentials
- Create, load, and seed the database:
bin/rake db:reset
- Create
.env
by copying.env.example
and modify the Stripe keys to match the ones from your account. The admin login credentials can be changed or used as-is for testing.
To start the server normally:
bin/rails server
If using a virtual machine run the server using:
bin/rails server -b 0.0.0.0
See the Stripe docs Stripe docs for setting up payment testing.
Use credit card number 4111 1111 1111 1111 for testing successful orders.
Use bin/rspec --format documentation
to run automated RSpec model tests. The format documentation flag provides a readable format in the command line output.
Feature tests have been created with Capybara and Poltergeist. It is best to only run one test at a time since these take some time to run.
bin/rspec spec/features/<filename>