use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class SignupTest method should_sign_up.
@Test
public void should_sign_up() {
String email = randomEmail();
UserFlow navigation = signUp(navigate(), "Random User", email, DEFAULT_PASSWORD, DEFAULT_PASSWORD);
navigation = login(navigation, email);
VRaptorTestResult signedUpUser = navigation.followRedirect().execute();
signedUpUser.wasStatus(200).isValid();
List<String> messagesList = messagesList(signedUpUser);
assertTrue(messagesList.contains(message("signup.confirmation")));
}
use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class SignupTest method should_not_sign_up_with_invalid_email.
@Test
public void should_not_sign_up_with_invalid_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 AnswerQuestionTest method should_not_display_answer_form_when_not_logged_in.
@Test
public void should_not_display_answer_form_when_not_logged_in() {
Question question = createQuestionWithDao(moderator(), "Titulo da questao hahaha", "Descricao da questao longa demais", tag("java"));
UserFlow navigation = goToQuestionPage(navigate(), question);
VRaptorTestResult questionPage = navigation.followRedirect().execute();
questionPage.wasStatus(200).isValid();
Elements answerForm = getElementsByClass(questionPage.getResponseBody(), "answer-form");
assertTrue(answerForm.isEmpty());
}
use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class AnswerQuestionTest method should_answer_when_logged_in.
@Test
public void should_answer_when_logged_in() {
Question question = createQuestionWithDao(moderator(), "Titulo da questao hahaha", "Descricao da questao longa demais", tag("java"));
String description = "Resposta da questao do teste de edicao";
UserFlow navigation = login(navigate(), karmaNigga().getEmail());
navigation = answerQuestionWithFlow(navigation, question, description, false);
VRaptorTestResult questionAnswered = navigation.followRedirect().execute();
questionAnswered.wasStatus(200).isValid();
AnswerAndVotes answerAndVotes = questionAnswered.getObject("answers");
List<Answer> answers = new ArrayList<Answer>(answerAndVotes.getVotes().keySet());
Assert.assertEquals(description, answers.get(0).getDescription());
}
use of br.com.caelum.vraptor.test.VRaptorTestResult in project mamute by caelum.
the class AnswerQuestionTest method should_not_display_answer_form_when_already_answered.
@Test
public void should_not_display_answer_form_when_already_answered() {
Question question = createQuestionWithDao(moderator(), "Titulo da questao hahaha", "Descricao da questao longa demais", tag("java"));
User karmaNigga = karmaNigga();
answerQuestionWithDao(karmaNigga, question, "Resposta da questao do teste de edicao", false);
UserFlow navigation = login(navigate(), karmaNigga.getEmail());
navigation = goToQuestionPage(navigation, question);
VRaptorTestResult questionPage = navigation.followRedirect().execute();
questionPage.wasStatus(200).isValid();
Elements answerForm = getElementsByClass(questionPage.getResponseBody(), "answer-form");
assertTrue(answerForm.isEmpty());
}
Aggregations