Skip to content

Instantly share code, notes, and snippets.

@fabriziomachado
fabriziomachado / gist:1305832
Created October 22, 2011 09:59
nested_forms_test_passing
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