Sha256: 53bbd23cb09000dbd2a19bb25c36598928a075f0c226d8fe929899e9dc280a52
Contents?: true
Size: 916 Bytes
Versions: 8
Compression:
Stored size: 916 Bytes
Contents
SPEC_ROOT = File.expand_path(File.dirname(__FILE__)) unless defined? SPEC_ROOT $: << SPEC_ROOT $: << File.join(File.dirname(__FILE__), '..', 'lib') require 'rubygems' require 'spec' require 'fakeweb' require 'yaml' require 'webmock' include WebMock::API require 'rturk' # RTurk.log.level = Logger::DEBUG @aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml'))) RTurk.setup(@aws['AWSAccessKeyId'], @aws['AWSAccessKey'], :sandbox => true) def faker(response_name, opts = {}) response = File.read(File.join(SPEC_ROOT, 'fake_responses', "#{response_name.to_s}.xml")) if opts[:operation] stub_request(:post, /amazonaws.com/).with(:body => /Operation=#{opts[:operation]}/).to_return(:body => response) else stub_request(:post, /amazonaws.com/).to_return(:body => response) end end def fake_response(xml) mock('RestClientFakeResponse', :body => xml) end Spec::Runner.configure do |config| end
Version data entries
8 entries across 8 versions & 1 rubygems