From 52b044d6a4278c229992404ad5801769c2d13363 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 24 Aug 2025 20:29:54 +0200 Subject: First commit. Vive le Castel Peter ! --- test/controllers/crops_controller_test.rb | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/controllers/crops_controller_test.rb (limited to 'test/controllers/crops_controller_test.rb') 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 -- cgit v1.2.3