From be2a93525069de2dfa3c23b0c23e7a9f7ad4c03d Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 29 Dec 2024 15:14:43 +0100 Subject: First commit. --- test/models/score_test.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/models/score_test.rb (limited to 'test/models/score_test.rb') diff --git a/test/models/score_test.rb b/test/models/score_test.rb new file mode 100644 index 0000000..a895158 --- /dev/null +++ b/test/models/score_test.rb @@ -0,0 +1,41 @@ +require "test_helper" + +class ScoreTest < ActiveSupport::TestCase + def setup + @score = scores(:one) + end + + test "should be valid with valid attributes" do + assert @score.valid? + end + + test "should have associated tartiflette" do + @score.tartiflette = nil + assert_not @score.valid?, "Score has no associated tartiflette." + end + + test "should have associated scoring_criterium" do + @score.scoring_criterium = nil + assert_not @score.valid?, "Score has no associated scoring_criterium." + end + + test "should have value" do + @score.value = nil + assert_not @score.valid?, "Score has no value." + end + + test "value should be between 1 and 5" do + @score.value = 3 + assert @score.valid?, "Score value is invalid." + end + + test "value should be greater than or equal to 1" do + @score.value = 0 + assert_not @score.valid?, "Score is less than 1." + end + + test "value should be less than or equal to 5" do + @score.value = 6 + assert_not @score.valid?, "Score is greater than 5." + end +end -- cgit v1.2.3