[Rails] Fertilizer recipe solver for the FAPG.
1
require"application_system_test_case"
2
3
classCropsTest<ApplicationSystemTestCase
4
setup do
5
@crop = crops(:one)
6
end
7
8
test "visiting the index" do
9
visit crops_url
10
assert_selector "h1", text: "Crops"
11
end
12
13
test "should create crop" do
14
visit crops_url
15
click_on "New crop"
16
17
fill_in "B", with: @crop.b
18
fill_in "Ca", with: @crop.ca
19
fill_in "Cl", with: @crop.cl
20
fill_in "Crop type", with: @crop.crop_type
21
fill_in "Cu", with: @crop.cu
22
fill_in "Fe", with: @crop.fe
23
fill_in "K", with: @crop.k
24
fill_in "Mg", with: @crop.mg
25
fill_in "Mn", with: @crop.mn
26
fill_in "Mo", with: @crop.mo
27
fill_in "Na", with: @crop.na
28
fill_in "Name", with: @crop.name
29
fill_in "Nnh4", with: @crop.nnh4
30
fill_in "Nno3", with: @crop.nno3
31
fill_in "P", with: @crop.p
32
fill_in "S", with: @crop.s
33
fill_in "Si", with: @crop.si
34
fill_in "Zn", with: @crop.zn
35
click_on "Create Crop"
36
37
assert_text "Crop was successfully created"
38
click_on "Back"
39
end
40
41
test "should update Crop" do
42
visit crop_url(@crop)
43
click_on "Edit this crop", match: :first
44
45
fill_in "B", with: @crop.b
46
fill_in "Ca", with: @crop.ca
47
fill_in "Cl", with: @crop.cl
48
fill_in "Crop type", with: @crop.crop_type
49
fill_in "Cu", with: @crop.cu
50
fill_in "Fe", with: @crop.fe
51
fill_in "K", with: @crop.k
52
fill_in "Mg", with: @crop.mg
53
fill_in "Mn", with: @crop.mn
54
fill_in "Mo", with: @crop.mo
55
fill_in "Na", with: @crop.na
56
fill_in "Name", with: @crop.name
57
fill_in "Nnh4", with: @crop.nnh4
58
fill_in "Nno3", with: @crop.nno3
59
fill_in "P", with: @crop.p
60
fill_in "S", with: @crop.s
61
fill_in "Si", with: @crop.si
62
fill_in "Zn", with: @crop.zn
63
click_on "Update Crop"
64
65
assert_text "Crop was successfully updated"
66
click_on "Back"
67
end
68
69
test "should destroy Crop" do
70
visit crop_url(@crop)
71
click_on "Destroy this crop", match: :first
72
73
assert_text "Crop was successfully destroyed"
74
end
75
end
76