ajout de tests unitaires sur le model team
This commit is contained in:
parent
d2e888405a
commit
544537ead4
2 changed files with 17 additions and 3 deletions
|
|
@ -1,2 +1,4 @@
|
|||
class Team < ApplicationRecord
|
||||
validates :name, uniqueness: true, presence: true
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,19 @@
|
|||
require "test_helper"
|
||||
|
||||
class TeamTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
test "team with valid name should be created" do
|
||||
team = Team.new(name: "Valid name", description: "Random description")
|
||||
assert team.valid?
|
||||
end
|
||||
|
||||
test "team with taken name should not be created" do
|
||||
other_team = teams(:one)
|
||||
team = Team.new(name: other_team.name, description: "Random description")
|
||||
assert_not team.valid?
|
||||
end
|
||||
|
||||
test "team without name should not be created" do
|
||||
team = Team.new(description: "Random description")
|
||||
assert_not team.valid?
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue