use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class EditQuestionTest method should_edit_question_of_other_author.
@Test
public void should_edit_question_of_other_author() throws Exception {
Question question = createQuestionWithDao(moderator(), "Title title title title title title title", "Description description description description description", tag("java"));
String newTitle = "NEW title title title title title title title";
String newDescription = "NEW description description description description description";
UserFlow navigation = login(navigate(), karmaNigga().getEmail());
navigation = editQuestionWithFlow(navigation, question, newTitle, newDescription, "edited question woots!", "java");
VRaptorTestResult editedQuestion = navigation.followRedirect().execute();
editedQuestion.wasStatus(200).isValid();
List<String> messagesList = messagesList(editedQuestion);
assertTrue(messagesList.contains(message("status.pending")));
}
use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class EditQuestionTest method should_edit_and_automatically_approve_author_edit.
@Test
public void should_edit_and_automatically_approve_author_edit() throws Exception {
User karmaNigga = karmaNigga();
Question question = createQuestionWithDao(karmaNigga, "Title title title title title title title", "Description description description description description", tag("java"));
String newTitle = "NEW title title title title title title title";
String newDescription = "NEW description description description description description";
UserFlow navigation = login(navigate(), karmaNigga.getEmail());
navigation = editQuestionWithFlow(navigation, question, newTitle, newDescription, "edited question woots!", "java");
VRaptorTestResult editedQuestion = navigation.followRedirect().execute();
editedQuestion.wasStatus(200).isValid();
List<String> messagesList = messagesList(editedQuestion);
assertTrue(messagesList.contains(message("status.no_need_to_approve")));
Question fetchQuestion = editedQuestion.getObject("question");
assertEquals(newTitle, fetchQuestion.getTitle());
assertEquals(newDescription, fetchQuestion.getDescription());
}
use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class ForgotPasswordTest method should_deny_recovery_for_inexistant_email.
@Test
public void should_deny_recovery_for_inexistant_email() {
UserFlow navigation = tryToSendResetPasswordEmail("unexistant@brutal.com");
VRaptorTestResult sentEmail = navigation.followRedirect().execute();
sentEmail.wasStatus(200).isValid();
List<String> errorsList = errorsList(sentEmail);
assertTrue(errorsList.contains(message("forgot_password.invalid_email")));
}
use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class SignupTest method should_not_sign_up_with_an_existent_email.
@Test
public void should_not_sign_up_with_an_existent_email() {
UserFlow navigation = signUp(navigate(), "Marco", "invalidEmail", DEFAULT_PASSWORD, DEFAULT_PASSWORD);
VRaptorTestResult notSignedUpUser = navigation.followRedirect().execute();
notSignedUpUser.wasStatus(200).isValid();
List<String> errorsList = errorsList(notSignedUpUser);
assertTrue(errorsList.contains(message("user.errors.email.invalid")));
}
use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class SignupTest method should_not_sign_up_with_different_passwords.
@Test
public void should_not_sign_up_with_different_passwords() {
UserFlow navigation = signUp(navigate(), "Marco", randomEmail(), DEFAULT_PASSWORD, "misspelledPassword");
VRaptorTestResult notSignedUpUser = navigation.followRedirect().execute();
notSignedUpUser.wasStatus(200).isValid();
List<String> errorsList = errorsList(notSignedUpUser);
assertTrue(errorsList.contains(message("signup.errors.password_confirmation")));
}
Aggregations