Sha256: d4a826afa0f24ad40e88014b1e228850d048312c2ba32a9727a214fc02e855f3

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'answer'

describe Answer, " when first created" do

  before(:each) do
    question = mock("Question", :id => 2, :parser => mock("Parser", :new_answer_id => 1))
    question.stub!(:class => Question)
    options = {:help_text => "Never or rarely ever", :reference_identifier => "b3a_1"}
    @ans = Answer.new(question, ["No / Rarely"], options)
  end
  
  it "should set inititalized variables to those passed in" do
    @ans.id.should == 1
    @ans.question_id.should == 2
    @ans.reference_identifier.should == "b3a_1"
    @ans.text.should == "No / Rarely"
    @ans.help_text.should == "Never or rarely ever"
  end
  
  it "should output current state to yml" do
     @ans.should.respond_to?(:to_yml)
  end

  it "should create a normalized code automatically when initalized" do
    @ans.data_export_identifier.should eql("no_rarely")
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
surveyor-0.9.1 script/surveyor/specs/answer_spec.rb
surveyor-0.9.0 script/surveyor/specs/answer_spec.rb