summaryrefslogtreecommitdiff
path: root/test/system/crops_test.rb
blob: bbf3e2892b5a1de8db034c2edd532d9b33a7bfde (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require "application_system_test_case"

class CropsTest < ApplicationSystemTestCase
  setup do
    @crop = crops(:one)
  end

  test "visiting the index" do
    visit crops_url
    assert_selector "h1", text: "Crops"
  end

  test "should create crop" do
    visit crops_url
    click_on "New crop"

    fill_in "B", with: @crop.b
    fill_in "Ca", with: @crop.ca
    fill_in "Cl", with: @crop.cl
    fill_in "Crop type", with: @crop.crop_type
    fill_in "Cu", with: @crop.cu
    fill_in "Fe", with: @crop.fe
    fill_in "K", with: @crop.k
    fill_in "Mg", with: @crop.mg
    fill_in "Mn", with: @crop.mn
    fill_in "Mo", with: @crop.mo
    fill_in "Na", with: @crop.na
    fill_in "Name", with: @crop.name
    fill_in "Nnh4", with: @crop.nnh4
    fill_in "Nno3", with: @crop.nno3
    fill_in "P", with: @crop.p
    fill_in "S", with: @crop.s
    fill_in "Si", with: @crop.si
    fill_in "Zn", with: @crop.zn
    click_on "Create Crop"

    assert_text "Crop was successfully created"
    click_on "Back"
  end

  test "should update Crop" do
    visit crop_url(@crop)
    click_on "Edit this crop", match: :first

    fill_in "B", with: @crop.b
    fill_in "Ca", with: @crop.ca
    fill_in "Cl", with: @crop.cl
    fill_in "Crop type", with: @crop.crop_type
    fill_in "Cu", with: @crop.cu
    fill_in "Fe", with: @crop.fe
    fill_in "K", with: @crop.k
    fill_in "Mg", with: @crop.mg
    fill_in "Mn", with: @crop.mn
    fill_in "Mo", with: @crop.mo
    fill_in "Na", with: @crop.na
    fill_in "Name", with: @crop.name
    fill_in "Nnh4", with: @crop.nnh4
    fill_in "Nno3", with: @crop.nno3
    fill_in "P", with: @crop.p
    fill_in "S", with: @crop.s
    fill_in "Si", with: @crop.si
    fill_in "Zn", with: @crop.zn
    click_on "Update Crop"

    assert_text "Crop was successfully updated"
    click_on "Back"
  end

  test "should destroy Crop" do
    visit crop_url(@crop)
    click_on "Destroy this crop", match: :first

    assert_text "Crop was successfully destroyed"
  end
end
Copyright 2019--2025 Marius PETER