package roles

import "testing"

func Test_subject_HasRole(t *testing.T) {
	subject := NewSubject(Author, Organizer)

	if !subject.HasRole(Author) {
		t.Errorf("HasRole(%q) = false, want true", Author)
	}
	if !subject.HasRole(Organizer) {
		t.Errorf("HasRole(%q) = false, want true", Organizer)
	}
	if subject.HasRole(Admin) {
		t.Errorf("HasRole(%q) = true, want false", Admin)
	}
}

func Test_subject_HasRoleEmpty(t *testing.T) {
	subject := NewSubject()

	if subject.HasRole(User) {
		t.Errorf("HasRole(%q) = true, want false для субъекта без ролей", User)
	}
}
