spec spec/controllers/products_controller_spec.rb ....FFFFF........
Failures:
1) ProductsController POST #create with valid params creates a new Product Failure/Error: expect { post :create, params: {product: valid_attributes} }.to change(Product, :count).by(1)
expected #count to have changed by 1, but was changed by 0
# ./spec/controllers/products_controller_spec.rb:82:in `block (4 levels) in <top (required)>'
2) ProductsController POST #create with valid params assigns a newly created product as @product Failure/Error: expect(assigns(:product)).to be_a(Product) expected nil to be a kind of Product(id: integer, name: string, pricing: decimal, description: text, user_id: integer, avatar_file... avatar_file_size: integer, avatar_updated_at: datetime, created_at: datetime, updated_at: datetime) # ./spec/controllers/products_controller_spec.rb:89:in `block (4 levels) in '
3) ProductsController POST #create with valid params redirects to the created product Failure/Error: expect(response).to redirect_to(Product.last)
Expected response to be a redirect to <http://test.host/products> but was a redirect to <http://test.host/users/sign_in>.
Expected "http://test.host/products" to be === "http://test.host/users/sign_in".
# ./spec/controllers/products_controller_spec.rb:95:in `block (4 levels) in <top (required)>'
4) ProductsController POST #create with invalid params assigns a newly created but unsaved product as @product Failure/Error: expect(assigns(:product)).to be_a_new(Product) expected nil to be a new Product(id: integer, name: string, pricing: decimal, description: text, user_id: integer, avatar_file_name: string, avatar_content_type: string, avatar_file_size: integer, avatar_updated_at: datetime, created_at: datetime, updated_at: datetime) # ./spec/controllers/products_controller_spec.rb:102:in `block (4 levels) in '
5) ProductsController POST #create with invalid params re-renders the 'new' template Failure/Error: expect(response).to render_template("new") expecting <"new"> but rendering with <[]> # ./spec/controllers/products_controller_spec.rb:107:in `block (4 levels) in '
Finished in 1.05 seconds (files took 17.93 seconds to load) 17 examples, 5 failures
Failed examples:
rspec ./spec/controllers/products_controller_spec.rb:81 # ProductsController POST #create with valid params creates a new Product rspec ./spec/controllers/products_controller_spec.rb:87 # ProductsController POST #create with valid params assigns a newly created product as @product rspec ./spec/controllers/products_controller_spec.rb:93 # ProductsController POST #create with valid params redirects to the created product rspec ./spec/controllers/products_controller_spec.rb:100 # ProductsController POST #create with invalid params assigns a newly created but unsaved product as @product rspec ./spec/controllers/products_controller_spec.rb:105 # ProductsController POST #create with invalid params re-renders the 'new' template
C:\Users\Sunshine\Desktop\CodFacil\cursoRubies\Rails_ecommerce>