API de comptabilité horaire.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

activity_test.rb 846B

1234567891011121314151617181920
  1. require "test_helper"
  2. class ActivityTest < ActiveSupport::TestCase
  3. test "activity's author should exist" do
  4. user = User.new(email: "test@test.com", username: "UserTest", password_digest: '$6$12$password')
  5. activity = Activity.new(name: "Pyheatpump", description: "A software to control heat pumps", author: user)
  6. assert activity.valid?
  7. end
  8. test "not valid if name does not exist" do
  9. user = User.new(email: "test@test.com", username: "UserTest", password_digest: '$6$12$password')
  10. activity = Activity.new(description: "A software to control heat pumps", author: user)
  11. assert_not activity.valid?
  12. end
  13. test "not valid if author does not exist" do
  14. activity = Activity.new(name: "Pyheatpump", description: "A software to control heat pumps", author: User.find_by_id(666))
  15. assert_not activity.valid?
  16. end
  17. end