diff options
Diffstat (limited to 'test/controllers/crops_controller_test.rb')
-rw-r--r-- | test/controllers/crops_controller_test.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/controllers/crops_controller_test.rb b/test/controllers/crops_controller_test.rb new file mode 100644 index 0000000..71821b1 --- /dev/null +++ b/test/controllers/crops_controller_test.rb @@ -0,0 +1,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 |