package br.com.caelum.brutal.integration.scene;

import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;

import org.junit.Test;

public class AnswerQuestionTest extends AuthenticatedAcceptanceTest{

	@Test
	public void should_answer_when_logged_in(){
		login();
		
		String newDescription = "My very very awsome Answer big enough :)";
		boolean firstAnswerHasDescription = home().toNewQuestionPage()
				.newQuestion("my question my question my question",
				"my description my description my description", "java")
				.answer(newDescription)
				.firstAnswerHasDescription(newDescription);
		
		assertTrue(firstAnswerHasDescription);
	}
	
	@Test
	public void should_not_display_answer_form_when_not_logged_in(){
		login();
		
		home().toNewQuestionPage()
			.newQuestion("my question my question my question",
			"my description my description my description", "java");

		logout();
		boolean firstAnswerHasDescription = home()
			.toFirstQuestionPage()
			.isAnswerFormDisplayed();

		assertFalse(firstAnswerHasDescription);
		
	}
}

@@ -936,33 +936,29 @@
 ean 
-first
+is
 Answer
-HasDescription
+FormDisplayed
  = h
@@ -1037,40 +1037,473 @@
 lse(
-firstAnswerHasDescription);%0A%09%09
+isAnswerFormDisplayed);%0A%09%7D%0A%09%0A%09@Test%0A%09public void should_not_display_answer_form_when_already_answered()%7B%0A%09%09login();%0A%0A%09%09String newDescription = %22My very very awsome Answer big enough :)%22;%0A%09%09boolean isAnswerFormDisplayed = home().toNewQuestionPage()%0A%09%09%09%09.newQuestion(%22my question my question my question%22,%0A%09%09%09%09%22my description my description my description%22, %22java%22)%0A%09%09%09%09.answer(newDescription)%09%09%0A%09%09%09%09.isAnswerFormDisplayed();%0A%09%09%0A%09%09assertFalse(isAnswerFormDisplayed);
 %0A%09%7D%0A%7D
-%0A

teste de responder duas vezes a mesma pergunta