summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-03-16 21:53:23 -0600
committerHombreLaser <sebastian-440@live.com>2023-03-16 21:53:23 -0600
commit69153b46eee0fec67efa66f9b5f0499730a98829 (patch)
treef07d8de984911fcf6d684b06ae69516cc9aa2b43 /spec/controllers
parentec60f7fb4be7213174f150318e418cdd8832a39b (diff)
Mejorado código de ProductsController
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/products_controller_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/controllers/products_controller_spec.rb b/spec/controllers/products_controller_spec.rb
new file mode 100644
index 0000000..d4f1373
--- /dev/null
+++ b/spec/controllers/products_controller_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+RSpec.describe Api::ProductsController, type: :controller do
+ let(:product) { create(:product) }
+
+ it { should route(:post, '/api/products').to(action: :create) }
+ it { should route(:put, "/api/products#{product.public_id}").to(action: :update, id: product.public_id) }
+ it { should route(:get, '/api/products').to(action: :index) }
+ it { should route(:get, "/api/products/#{product.public_id}").to(action: :show, id: product.public_id) }
+ it { should route(:delete, "/api/products/#{product.public_id}").to(action: :destroy, id: product.public_id) }
+end