Sha256: a612bdf6e06a05a5fa461bd0a243a1c2d3875e7356bb1fef554fa359816db8a6
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
require 'spec_helper' describe RTurk::Requester do before(:all) do FakeWeb.clean_registry aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true) end it "should send the request to Amazon" do RestClient.should_receive(:get).with(/amazonaws.*Operation=GetHIT.*$/) RTurk::Requester.request(:Operation => 'GetHIT', 'HITId' => 'test') end it "should build a correct querystring with one value per key" do params = { :Operation => 'GetHIT', 'Param1' => 'test1', 'Param2' => 'test2' } RestClient.should_receive(:get).with( /(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2=test2)/) RTurk::Requester.request(params) end it "should build a correct querystring with two values per key" do params = { :Operation => 'GetHIT', 'Param1' => 'test1', 'Param2' => %w(test2a test2b) } RestClient.should_receive(:get).with( /(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2=test2a)(?=.*Param2=test2b)/) RTurk::Requester.request(params) end it "should build a correct querystring with a hash of values" do params = { :Operation => 'GetHIT', 'Param1' => 'test1', 'Param2' => {0 => 'test2a', 1 => 'test2b'} } RestClient.should_receive(:get).with( /(?=.*Operation=GetHIT)(?=.*Param1=test1)(?=.*Param2.0=test2a)(?=.*Param2.1=test2b)/) RTurk::Requester.request(params) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rturk-2.3.6 | spec/requester_spec.rb |
rturk-2.3.5 | spec/requester_spec.rb |