Sha256: bca24ea5b461ca5fd0e7d164ccfd16a9f4645c5aecced09be494496c973a97df
Contents?: true
Size: 1.23 KB
Versions: 27
Compression:
Stored size: 1.23 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) describe RTurk::AnswerParser do before(:all) do @answer = <<-XML <?xml version="1.0" encoding="UTF-8"?> <QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd"> <Answer> <QuestionIdentifier>tweet[content]</QuestionIdentifier> <FreeText>This is my tweet!</FreeText> </Answer> <Answer> <QuestionIdentifier>tweet[time]</QuestionIdentifier> <FreeText>12345678</FreeText> </Answer> <Answer> <QuestionIdentifier>Submit</QuestionIdentifier> <FreeText>Submit</FreeText> </Answer> </QuestionFormAnswers> XML end it "should parse a answer" do RTurk::AnswerParser.parse(@answer).to_hash.should == {"Submit"=>"Submit", "tweet[content]"=>"This is my tweet!", "tweet[time]" => "12345678"} end it "should parse an answer into a param hash" do hash = RTurk::AnswerParser.parse(@answer).to_hash RTurk::Parser.new.normalize_nested_params(hash).should == {"Submit"=>"Submit", "tweet"=> {"content" => "This is my tweet!", "time" => "12345678"}} end end
Version data entries
27 entries across 27 versions & 1 rubygems