Sha256: 4e5410f38552c10ae6c3eb1ccf16fcfba7e319e046a3d30026b8688ee0497b51

Contents?: true

Size: 912 Bytes

Versions: 6

Compression:

Stored size: 912 Bytes

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
    
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
surveyor-0.18.1 spec/models/answer_spec.rb
surveyor-0.18.0 spec/models/answer_spec.rb
surveyor-0.17.0 spec/models/answer_spec.rb
surveyor-0.16.1 spec/models/answer_spec.rb
surveyor-0.16.0 spec/models/answer_spec.rb
surveyor-0.15.0 spec/models/answer_spec.rb