Sha256: af13c588c07d6bf6af9e988a28e52a2eaf2254c638aa43a1dba1b0a7705d7dfa

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))


describe RTurk::HITParser do
  
  before(:all) do
    @hit_xml = <<-XML
<HIT>
  <HITId>ZZRZPTY4ERDZWJ868JCZ</HITId>
  <HITTypeId>NYVZTQ1QVKJZXCYZCZVZ</HITTypeId>
  <CreationTime>2009-07-07T00:56:40Z</CreationTime>
  <Title>Location</Title>
  <Description>Select the image that best represents</Description>
  <HITStatus>Assignable</HITStatus>
  <MaxAssignments>1</MaxAssignments>
  <Reward>
    <Amount>5.00</Amount>
    <CurrencyCode>USD</CurrencyCode>
    <FormattedPrice>$5.00</FormattedPrice>
  </Reward>
  <AutoApprovalDelayInSeconds>2592000</AutoApprovalDelayInSeconds>
  <Expiration>2009-07-14T00:56:40Z</Expiration>
  <AssignmentDurationInSeconds>30</AssignmentDurationInSeconds>
  <NumberOfAssignmentsPending>0</NumberOfAssignmentsPending>
  <NumberOfAssignmentsAvailable>1</NumberOfAssignmentsAvailable>
  <NumberOfAssignmentsCompleted>0</NumberOfAssignmentsCompleted>
</HIT>
      XML
    @hit_xml = Nokogiri::XML(@hit_xml)
    @hit = RTurk::HITParser.new(@hit_xml.children)
  end
  
  it "should parse a answer" do
    @hit.id.should eql('ZZRZPTY4ERDZWJ868JCZ')
    @hit.type_id.should eql('NYVZTQ1QVKJZXCYZCZVZ')
    @hit.status.should eql('Assignable')
    @hit.reward_amount.should eql(5.00)
  end

  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rturk-2.0.4 spec/parsers/hit_parser_spec.rb
rturk-2.0.3 spec/parsers/hit_parser_spec.rb