diff --git a/app/controllers/usm_school_informations_controller.rb b/app/controllers/usm_school_informations_controller.rb index 4c8de9b..84fdbbf 100644 --- a/app/controllers/usm_school_informations_controller.rb +++ b/app/controllers/usm_school_informations_controller.rb @@ -8,6 +8,7 @@ def update if @usm_school.update(usm_school_information_params) flash[:success] = "usm school information is updated" else + puts @usm_school.errors.full_messages render 'edit' end end @@ -28,10 +29,10 @@ def edit def show end private - def usm_school_information_params - params.require(:usm_school_information).permit( - :jurusan_sekolah, :asal_sekolah, :akreditas, :jumlah_nilai_un, - :jumlah_pelajaran_un, :jumlah_pelajaran_semester_5, :jumlah_nilai_semester_5 - ) - end + def usm_school_information_params + params.require(:usm_school_information).permit( + :jurusan_sekolah, :asal_sekolah, :akreditas, :jumlah_nilai_un, + :jumlah_pelajaran_un, :jumlah_pelajaran_semester_5, :jumlah_nilai_semester_5 + ) + end end diff --git a/test/controllers/usm_school_informations_controller_test.rb b/test/controllers/usm_school_informations_controller_test.rb index b81593a..6c13480 100644 --- a/test/controllers/usm_school_informations_controller_test.rb +++ b/test/controllers/usm_school_informations_controller_test.rb @@ -77,8 +77,8 @@ def setup jumlah_pelajaran_semester_5: 15, jumlah_nilai_semester_5: 799.9 } } + assert_equal 'usm school information is updated', flash[:success] usm_school_informations(:usm_one).reload - puts usm_school_informations(:usm_one).reload.jurusan_sekolah assert_equal 'ipa MA', usm_school_informations(:usm_one).reload.jurusan_sekolah assert_equal 'sma santo tomas 2', usm_school_informations(:usm_one).asal_sekolah assert_equal 'terakreditasi', usm_school_informations(:usm_one).akreditas diff --git a/test/fixtures/usm_school_informations.yml b/test/fixtures/usm_school_informations.yml index 841bebd..b798e13 100644 --- a/test/fixtures/usm_school_informations.yml +++ b/test/fixtures/usm_school_informations.yml @@ -4,7 +4,7 @@ usm_one: user: archer asal_sekolah: MyString akreditas: MyString - jumlah_pelajaran_un: 1 + jumlah_pelajaran_un: 2 jumlah_nilai_un: 9.99 jurusan_sekolah: MyString jumlah_pelajaran_semester_5: 1 @@ -14,7 +14,7 @@ usm_two: user: iana asal_sekolah: MyString akreditas: MyString - jumlah_pelajaran_un: 1 + jumlah_pelajaran_un: 2 jumlah_nilai_un: 9.99 jurusan_sekolah: MyString jumlah_pelajaran_semester_5: 1