Sha256: a5c6377c56f1d76b6467d20e4c2ffe95788521a2b5d74e8ef893b6065d17db5d
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Answer, "when creating a new answer" do before(:each) do @answer = Factory(:answer, :text => "Red") end it "should be valid" do @answer.should be_valid end # this causes issues with building and saving answers to questions within a grid. # it "should be invalid without a question_id" do # @answer.question_id = nil # @answer.should_not be_valid # end it "should have 'default' renderer with nil question.pick and response_class" do @answer.question = Factory(:question, :pick => nil) @answer.response_class = nil @answer.renderer.should == :default end it "should have a_b renderer for a question.pick and B response_class" do @answer.question = Factory(:question, :pick => "a") @answer.response_class = "B" @answer.renderer.should == :a_b end it "should delete validation when it is deleted" do v_id = Factory(:validation, :answer => @answer).id @answer.destroy Validation.find_by_id(v_id).should be_nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
surveyor-0.18.2 | spec/models/answer_spec.rb |