Sha256: 751a4de85df540b7360fbd70da5633e2152f835fa052cdf679ba53fc8fa824b6
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) require 'cgi' describe RTurk::ExternalQuestion do before(:all) do end it "should build a question" do question = RTurk::ExternalQuestion.new('http://mpercival.com') question.url.should == 'http://mpercival.com' question.frame_height.should == 400 end it "should build a question " do question = RTurk::ExternalQuestion.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 " do question = RTurk::ExternalQuestion.new('http://mpercival.com?myparam=true&anotherparam=12', :frame_height => 500) question.url.should == 'http://mpercival.com?myparam=true&anotherparam=12' question.frame_height.should == 500 end it "should build a question with params" do params = RTurk::ExternalQuestion.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::ExternalQuestion.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rturk-2.11.1 | spec/builders/external_question_spec.rb |
rturk-2.11.0 | spec/builders/external_question_spec.rb |