diff options
author | Marius Peter <marius.peter@tutanota.com> | 2024-12-29 15:14:43 +0100 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2024-12-29 15:14:43 +0100 |
commit | be2a93525069de2dfa3c23b0c23e7a9f7ad4c03d (patch) | |
tree | b5493e9d35d024ce7be072ec2168b4a98ba0e63f /test/models/score_test.rb |
First commit.
Diffstat (limited to 'test/models/score_test.rb')
-rw-r--r-- | test/models/score_test.rb | 41 |
1 files changed, 41 insertions, 0 deletions
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 |