| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- require "application_system_test_case"
- class ProductsTest < ApplicationSystemTestCase
- setup do
- @product = products(:one)
- end
- test "visiting the index" do
- visit products_url
- assert_selector "h1", text: "Products"
- end
- test "should create product" do
- visit products_url
- click_on "New product"
- fill_in "Description", with: @product.description
- fill_in "Price", with: @product.price
- fill_in "Title", with: @product.title
- click_on "Create Product"
- assert_text "Product was successfully created"
- click_on "Back"
- end
- test "should update Product" do
- visit product_url(@product)
- click_on "Edit this product", match: :first
- fill_in "Description", with: @product.description
- fill_in "Price", with: @product.price
- fill_in "Title", with: @product.title
- click_on "Update Product"
- assert_text "Product was successfully updated"
- click_on "Back"
- end
- test "should destroy Product" do
- visit product_url(@product)
- accept_confirm { click_on "Destroy this product", match: :first }
- assert_text "Product was successfully destroyed"
- end
- end
|