Search in sources :

Example 1 with UpdateStatus

use of org.mamute.model.UpdateStatus in project mamute by caelum.

the class UpdaterTest method should_be_pending_if_is_not_author.

@Test
public void should_be_pending_if_is_not_author() {
    User user = user("chico", "chico@gmail.com", nextId());
    QuestionInformation newInformation = new QuestionInformation("title", notMarked("description"), new LoggedUser(user, null));
    UpdateStatus update = updater.update(myQuestion, newInformation);
    assertEquals(UpdateStatus.PENDING, update);
    assertTrue(myQuestion.getHistory().contains(newInformation));
}
Also used : User(org.mamute.model.User) LoggedUser(org.mamute.model.LoggedUser) UpdateStatus(org.mamute.model.UpdateStatus) LoggedUser(org.mamute.model.LoggedUser) QuestionInformation(org.mamute.model.QuestionInformation) Test(org.junit.Test)

Example 2 with UpdateStatus

use of org.mamute.model.UpdateStatus in project mamute by caelum.

the class UpdaterTest method should_update_if_is_the_author.

@Test
public void should_update_if_is_the_author() {
    QuestionInformation newInformation = new QuestionInformation("title", notMarked("description"), new LoggedUser(author, null));
    UpdateStatus update = updater.update(myQuestion, newInformation);
    assertEquals(UpdateStatus.NO_NEED_TO_APPROVE, update);
    assertTrue(myQuestion.getHistory().contains(newInformation));
}
Also used : UpdateStatus(org.mamute.model.UpdateStatus) LoggedUser(org.mamute.model.LoggedUser) QuestionInformation(org.mamute.model.QuestionInformation) Test(org.junit.Test)

Example 3 with UpdateStatus

use of org.mamute.model.UpdateStatus in project mamute by caelum.

the class UpdaterTest method should_update_if_is_moderator.

@Test
public void should_update_if_is_moderator() {
    User moderator = user("moderator", "moderator@brutal", nextId()).asModerator();
    QuestionInformation newInformation = new QuestionInformation("title", notMarked("description"), new LoggedUser(moderator, null));
    UpdateStatus update = updater.update(myQuestion, newInformation);
    assertEquals(UpdateStatus.NO_NEED_TO_APPROVE, update);
    assertTrue(myQuestion.getHistory().contains(newInformation));
}
Also used : User(org.mamute.model.User) LoggedUser(org.mamute.model.LoggedUser) UpdateStatus(org.mamute.model.UpdateStatus) LoggedUser(org.mamute.model.LoggedUser) QuestionInformation(org.mamute.model.QuestionInformation) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 LoggedUser (org.mamute.model.LoggedUser)3 QuestionInformation (org.mamute.model.QuestionInformation)3 UpdateStatus (org.mamute.model.UpdateStatus)3 User (org.mamute.model.User)2