Sha256: 709703bfcf63f11c3a4629175dc9f1bf9169946aacb28b1af881d195e1fcadb7
Contents?: true
Size: 1.42 KB
Versions: 6
Compression:
Stored size: 1.42 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) require 'cgi' describe RTurk::Question do before(:all) do end it "should build a question" do question = RTurk::Question.new('http://mpercival.com') question.url.should == 'http://mpercival.com' question.frame_height.should == 400 end it "should build a question " do question = RTurk::Question.new('http://mpercival.com', :frame_height => 500, :chapter => 1) question.params[:chapter] = 2 question.url.should == 'http://mpercival.com?chapter=2' question.frame_height.should == 500 end it "should build a question with params" do params = RTurk::Question.new('http://google.com/', :id => 'foo').to_params CGI.unescape(params).should == <<-XML <ExternalQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd"> <ExternalURL>http://google.com/?id=foo</ExternalURL> <FrameHeight>400</FrameHeight> </ExternalQuestion> XML end it "should build a question without params" do params = RTurk::Question.new('http://google.com/').to_params CGI.unescape(params).should == <<-XML <ExternalQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd"> <ExternalURL>http://google.com/</ExternalURL> <FrameHeight>400</FrameHeight> </ExternalQuestion> XML end end
Version data entries
6 entries across 6 versions & 1 rubygems