API de comptabilité horaire.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

membership_test.rb 926B

1234567891011121314151617181920212223242526272829303132
  1. require "test_helper"
  2. class MembershipTest < ActiveSupport::TestCase
  3. setup do
  4. @membership = memberships(:one)
  5. @user = users(:one)
  6. @user2 = users(:two)
  7. @team = teams(:one)
  8. @team2 = teams(:two)
  9. end
  10. test "membership should be valid" do
  11. membership = Membership.new(member_id: @user2.id, team_id: @team2.id, can_edit: false)
  12. assert membership.valid?
  13. end
  14. test "membership without member_id should not be valid" do
  15. membership = Membership.new(team_id: @team.id, can_edit: true)
  16. assert_not membership.valid?
  17. end
  18. test "membership without team_id should not be valid" do
  19. membership = Membership.new(member_id: @user.id, can_edit: true)
  20. assert_not membership.valid?
  21. end
  22. test "already existing membership should not be created again" do
  23. membership = Membership.new(member_id: @user.id, team_id: @team.id, can_edit: true)
  24. assert_not membership.valid?
  25. end
  26. end