summaryrefslogtreecommitdiff
path: root/test/controllers/fertilizer_products_controller_test.rb
blob: dbdd44f21e4f79f64858a6e1157b33c4ba0202bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require "test_helper"

class FertilizerProductsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @fertilizer_product = fertilizer_products(:one)
  end

  test "should get index" do
    get fertilizer_products_url
    assert_response :success
  end

  test "should get new" do
    get new_fertilizer_product_url
    assert_response :success
  end

  test "should create fertilizer_product" do
    assert_difference("FertilizerProduct.count") do
      post fertilizer_products_url, params: { fertilizer_product: { name: @fertilizer_product.name, purity: @fertilizer_product.purity } }
    end

    assert_redirected_to fertilizer_product_url(FertilizerProduct.last)
  end

  test "should show fertilizer_product" do
    get fertilizer_product_url(@fertilizer_product)
    assert_response :success
  end

  test "should get edit" do
    get edit_fertilizer_product_url(@fertilizer_product)
    assert_response :success
  end

  test "should update fertilizer_product" do
    patch fertilizer_product_url(@fertilizer_product), params: { fertilizer_product: { name: @fertilizer_product.name, purity: @fertilizer_product.purity } }
    assert_redirected_to fertilizer_product_url(@fertilizer_product)
  end

  test "should destroy fertilizer_product" do
    assert_difference("FertilizerProduct.count", -1) do
      delete fertilizer_product_url(@fertilizer_product)
    end

    assert_redirected_to fertilizer_products_url
  end
end
Copyright 2019--2025 Marius PETER