sudo apt install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.6.3
rvm use 2.6.3 --default
ruby -v
gem install bundler
gem install rails -v 6.0.2.1
bundle install
rake db:migrate
rails s
Finally, you can start testing.
GET ```localhost:3000/inventories```
GET ```localhost:3000/inventories/1```
POST ```localhost:3000/inventories```
{
"name" : "test 1",
"description" : "test desc 1",
"price" : 10.52,
"quantity": 10
}
PUT/PATCH localhost:3000/inventories/1
{
"name" : "test 1",
"description" : "test desc 1",
"price" : 10.52,
"quantity": 10
}
DELETE localhost:3000/inventories/1
GET localhost:3000/orders
GET localhost:3000/orders/1
POST localhost:3000/orders
{
"orders" : {
"email": "testtest.com",
"order_items": [
{
"inventory_id" : 4,
"quantity" : 1
},
{
"inventory_id" : 5,
"quantity" : 1
}
]
}
}
PUT/PATCH localhost:3000/orders/1
{
"orders" : {
"email": "test@test.com",
"order_items": [
{
"inventory_id" : 2,
"quantity" : 2
}
]
}
}
DELETE localhost:3000/orders/1
rspec spec/requests/create_inventory_spec.rb
rspec spec/requests/create_order_spec.rb
rspec spec/requests/delete_inventory_spec.rb
rspec spec/requests/delete_order_spec.rb
rspec spec/requests/get_inventories_spec.rb
rspec spec/requests/get_orders_spec.rb
rspec spec/requests/update_inventory_spec.rb
rspec spec/requests/update_order_spec.rb