summaryrefslogtreecommitdiff
path: root/test/models
diff options
context:
space:
mode:
Diffstat (limited to 'test/models')
-rw-r--r--test/models/.keep0
-rw-r--r--test/models/score_test.rb41
-rw-r--r--test/models/scoring_criterium_test.rb21
-rw-r--r--test/models/tartiflette_test.rb11
-rw-r--r--test/models/user_test.rb7
5 files changed, 80 insertions, 0 deletions
diff --git a/test/models/.keep b/test/models/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/models/.keep
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
diff --git a/test/models/scoring_criterium_test.rb b/test/models/scoring_criterium_test.rb
new file mode 100644
index 0000000..754e876
--- /dev/null
+++ b/test/models/scoring_criterium_test.rb
@@ -0,0 +1,21 @@
+require "test_helper"
+
+class ScoringCriteriumTest < ActiveSupport::TestCase
+ def setup
+ @scoring_criterium = scoring_criteria(:one)
+ end
+
+ test "should be valid with valid attributes" do
+ assert @scoring_criterium.valid?
+ end
+
+ test "should have category" do
+ @scoring_criterium.category = nil
+ assert_not @scoring_criterium.valid?, "Scoring Criterium has no category."
+ end
+
+ test "should have name" do
+ @scoring_criterium.name = nil
+ assert_not @scoring_criterium.valid?, "Scoring Criterium has no name."
+ end
+end
diff --git a/test/models/tartiflette_test.rb b/test/models/tartiflette_test.rb
new file mode 100644
index 0000000..63a4150
--- /dev/null
+++ b/test/models/tartiflette_test.rb
@@ -0,0 +1,11 @@
+require "test_helper"
+
+class TartifletteTest < ActiveSupport::TestCase
+ def setup
+ @tartiflette = tartiflettes(:one)
+ end
+
+ test "should be valid with valid attributes" do
+ assert @tartiflette.valid?
+ end
+end
diff --git a/test/models/user_test.rb b/test/models/user_test.rb
new file mode 100644
index 0000000..5c07f49
--- /dev/null
+++ b/test/models/user_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class UserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
Copyright 2019--2025 Marius PETER