This application builds an admin feature to upload products through a CSV file.
- Existing products (through
slug
field) are updated with the fields in the CSV - Creates new products for rows with no matching product (
slug
) - Runs a background job to process Products upload
- Admin can view status of upload, including error rows
- Ruby 2.4.2
- Rails 5.1.7
- Spree 3.5
- Sidekiq 5.2.7
- Redis
- Clone repo:
git clone git@github.com:raphaelakpan/spark_test_task.git
cd spark_test_task
- Install the gems:
bundle install
- Setup Database and load sample data
rails db:setup # runs migration, seeds the database
bundle exec rake spree_sample:load
- Run Sidekiq (different terminal)
bundle exec sidekiq
- Start the server
rails server
If your server is running, navigate to htpp://localhost:3000
Admin route: htpp://localhost:3000/admin
CSV column | Product attribute |
---|---|
name |
name |
description |
description |
price |
price |
availability_date |
available_on |
slug |
slug |
stock_total |
master.total_on_hand |
category |
taxons |
;name;description;price;availability_date;slug;stock_total;category
;Ruby on Rails Bag;Animi officia aut amet molestiae atque excepturi. Placeat est cum occaecati molestiae quia. Ut soluta ipsum doloremque perferendis eligendi voluptas voluptatum.;22,99;2017-12-04T14:55:22.913Z;ruby-on-rails-bag;15;Bags
From the Admin Products Upload Page, you can download a sample copy.
- Ensure test db is up current =>
rails:db migrate RAILS_ENV=test
rspec spec