A mini e-commerce application built with Rails 4.2 (Ruby 2.3.5) for using existing code style and approach to implement new features in unfamiliar territory.
- User/Visitor can signup/login/logout
- User/Visitor can see products detail
- User/Visitor can add products into cart and order products
- User recieves order recipt message via email
- Admin can see the number of products/categories/sales
- Admin can add/create new products/categories/sales
- Admin can remove products
- Empty Cart
- Sold Out Badge
- Order Details
- Signup/Login/Logout
- Category (admin)
- User Authentcation
- About Page
- Mailer
- Money Formatting
- Admin Security
- Dashboard
- Categories
used RSpec, Capybara, Poltergeist, Phantomjs
- Product/User Model (vaildations)
- Home Page (list products)
- Product Details (link to detail page)
- Add Product into Cart
Make an order (+ product detail)
- Make sure that you are runnning Ruby 2.6.6 (
ruby -v
) - Install ImageMagick
brew install imagemagick imagemagick@6 --build-from-source
- Remove Gemfile.lock
- Replace Gemfile with version provided here
- Run
bundle install
to install dependencies - Create
config/database.yml
by copyingconfig/database.example.yml
- Create
config/secrets.yml
by copyingconfig/secrets.example.yml
- Run
bin/rake db:reset
to create, load and seed db - Create .env file based on .env.example then set up your environment variables
- Sign up for a Stripe account
- Put Stripe (test) keys into appropriate .env vars
- Run
bin/rails s -b 0.0.0.0
to start the server (if you are not using vagrant,bin/rails s
) - Go to http://localhost:3000/ in your browser
Use Credit Card # 4111 1111 1111 1111 for testing success scenarios.
More information in their docs: https://stripe.com/docs/testing#cards
Generate the binstub so you can run
rspec
instead ofbundle exec rspec
from within the project directory:
bundle binstubs rspec-core
Let's create the test pg database. Your development and test databases are separate so that you can run your tests in isolation and neither one affects the other.
bin/rake db:setup RAILS_ENV=test
We are now ready to test
rspec
- Rails 4.2 Rails Guide
- PostgreSQL
- Stripe
- bcrypt
- rspec-rails
- capybara
- (admin)add new sale
- apply a discount
- implement mailer test
- feature - product rating
- feature - inventory adjustment