Sha256: 8654fd5bf2da3c46b1b3d8a1f7c446c6b24bbbdc9d9c5322979ba55302f1c4d4

Contents?: true

Size: 1.96 KB

Versions: 20

Compression:

Stored size: 1.96 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../lib/surveyor')

describe Surveyor do
  it "should create a normalized code from the answer text" do
    # The answer object should take the title of the text and convert it to a code that is more appropirate for a database entry
    


        
    # Taking a few answers from the survey for testing
    strings = [ "This? is a in - t3rrible-@nswer of! (question) on",
                "Private insurance/ HMO/ PPO",
                "<bold>VA</bold>",
                "PMS (Premenstrual syndrome)/ PMDD (Premenstrual Dysphoric Disorder)",
                "Have never been employed outside the home",
                "Professional",
                "Not working because of temporary disability, but expect to return to a job",
                "How long has it been since you last visited a doctor for a routine checkup (routine being not for a particular reason)?",
                "Do you take medications as directed?",
                "Do you every leak urine (or) water when you didn't want to?", #checking for () and ' removal
                "Do your biological family members (not adopted) have a \"history\" of any of the following?",
                "Your health:",
                "In general, you would say your health is:" ]
    
    # What the results should look like
    codes = [ "this_t3rrible_nswer",
              "private_insurance_hmo_ppo",
              "va",
              "pms_pmdd",
              "never_been_employed_outside_home",
              "professional",
              "temporary_disability_expect_return_job",              
              "visited_doctor_for_routine_checkup",
              "you_take_medications_as_directed",
              "urine_water_you_didnt_want",
              "family_members_history_any_following",
              "your_health",
              "you_would_say_your_health" ]
    
    strings.each_with_index do |s, i|
      Surveyor.to_normalized_string(s).should == codes[i]
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
ccls-surveyor-1.0.0 spec/lib/surveyor_spec.rb
jakewendt-surveyor-0.11.3 spec/lib/surveyor_spec.rb
surveyor-0.14.2 spec/lib/surveyor_spec.rb
surveyor-0.14.1 spec/lib/surveyor_spec.rb
surveyor-0.14.0 spec/lib/surveyor_spec.rb
surveyor-0.13.0 spec/lib/surveyor_spec.rb
surveyor-0.12.1 spec/lib/surveyor_spec.rb
surveyor-0.11.0 spec/lib/surveyor_spec.rb
surveyor-0.10.0 spec/lib/surveyor_spec.rb
surveyor-0.9.10 spec/lib/surveyor_spec.rb
surveyor-0.9.9 spec/lib/surveyor_spec.rb
surveyor-0.9.8 spec/lib/surveyor_spec.rb
surveyor-0.9.7 spec/lib/surveyor_spec.rb
surveyor-0.9.6 spec/lib/surveyor_spec.rb
surveyor-0.9.5 spec/lib/surveyor_spec.rb
surveyor-0.9.4 spec/lib/surveyor_spec.rb
surveyor-0.9.3 spec/lib/surveyor_spec.rb
surveyor-0.9.2 spec/lib/surveyor_spec.rb
surveyor-0.9.1 spec/lib/surveyor_spec.rb
surveyor-0.9.0 spec/lib/surveyor_spec.rb