Skip to content

Commit

Permalink
teste de criar questao que nao usa JS feito no VRTest agora
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosalles committed Dec 13, 2013
1 parent 660c172 commit 34172ab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ public void setup(){
login();
}

@Test
public void should_make_a_question() {
String title = "My new question about java";
String description = "just a question that i have about java hahahhaha";
String tags = "java";
boolean isTheQuestion = home()
.toNewQuestionPage()
.newQuestion(title, description, tags)
.hasInformation(title, description, tags);
assertTrue(isTheQuestion);
}

@Test
public void should_suggest_auto_complete() throws InterruptedException {
boolean hasAutoCompleteSuggestion = home()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package br.com.caelum.brutal.integration.scene.vraptor;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import org.junit.Test;

import br.com.caelum.brutal.model.Question;
import br.com.caelum.brutal.model.Tag;
import br.com.caelum.vraptor.test.VRaptorTestResult;
import br.com.caelum.vraptor.test.requestflow.UserFlow;

Expand All @@ -11,10 +16,19 @@ public class CreateQuestionTest extends CustomVRaptorIntegration {
public void should_make_a_question() {
String title = "My new question about java";
String description = "just a question that i have about java hahahhaha";
String tags = "java";
Tag tag = tag("java");

UserFlow navigation = login(navigate(), karmaNigga().getEmail());
navigation = createQuestionWithFlow(navigation, title, description, tags, false);
VRaptorTestResult execute = navigation.followRedirect().execute();
navigation = createQuestionWithFlow(navigation, title, description, tag.getName(), false);
VRaptorTestResult createdQuestion = navigation.followRedirect().execute();
createdQuestion.wasStatus(200).isValid();

Question question = createdQuestion.getObject("question");
Tag questionTag = question.getTags().get(0);

assertThat(question.getTitle(), equalTo(title));
assertThat(question.getDescription(), equalTo(description));
assertThat(questionTag.getName(), equalTo(tag.getName()));
}

}

0 comments on commit 34172ab

Please sign in to comment.