Created
October 22, 2011 09:59
-
-
Save fabriziomachado/1305832 to your computer and use it in GitHub Desktop.
nested_forms_test_passing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "create questions and answers for the exam" do | |
let(:build_object) { mock().as_null_object } | |
it "should instantiate at least 3 questions" do | |
exam_questions = mock("questions for an exam").as_null_object | |
Exam.any_instance.stub(:questions).and_return(exam_questions) | |
exam_questions.stub(:build).and_return(build_object) | |
exam_questions.should_receive(:build).exactly(3).times | |
get :new | |
end | |
it "should instantiate at least 4 answers for each of the 3 questions" do | |
Question.any_instance.stub(:answers).and_return(build_object) | |
build_object.should_receive(:build).exactly(12).times | |
get :new | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment