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 CropsControllerTest < ActionDispatch::IntegrationTest
setup do
@crop = crops(:one)
end
test "should get index" do
get crops_url
assert_response :success
end
test "should get new" do
get new_crop_url
assert_response :success
end
test "should create crop" do
assert_difference("Crop.count") do
post crops_url, params: { crop: { b: @crop.b, ca: @crop.ca, cl: @crop.cl, crop_type: @crop.crop_type, cu: @crop.cu, fe: @crop.fe, k: @crop.k, mg: @crop.mg, mn: @crop.mn, mo: @crop.mo, na: @crop.na, name: @crop.name, nnh4: @crop.nnh4, nno3: @crop.nno3, p: @crop.p, s: @crop.s, si: @crop.si, zn: @crop.zn } }
end
assert_redirected_to crop_url(Crop.last)
end
test "should show crop" do
get crop_url(@crop)
assert_response :success
end
test "should get edit" do
get edit_crop_url(@crop)
assert_response :success
end
test "should update crop" do
patch crop_url(@crop), params: { crop: { b: @crop.b, ca: @crop.ca, cl: @crop.cl, crop_type: @crop.crop_type, cu: @crop.cu, fe: @crop.fe, k: @crop.k, mg: @crop.mg, mn: @crop.mn, mo: @crop.mo, na: @crop.na, name: @crop.name, nnh4: @crop.nnh4, nno3: @crop.nno3, p: @crop.p, s: @crop.s, si: @crop.si, zn: @crop.zn } }
assert_redirected_to crop_url(@crop)
end
test "should destroy crop" do
assert_difference("Crop.count", -1) do
delete crop_url(@crop)
end
assert_redirected_to crops_url
end
end
|