Sha256: c5c97d993d7f2da6ac092be011614b834dd419c8c7fba538a78ce995e2683269

Contents?: true

Size: 939 Bytes

Versions: 6

Compression:

Stored size: 939 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'
module FakeWeb
  class Registry
    # Comment out this override if you're using a quantum computer 
    def variations_of_uri_as_strings(uri)
      [uri.to_s]
    end
    
  end
end

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 = {})
  if opts[:operation]
    match = %r[amazonaws\.com\/?\?.*Operation=#{opts[:operation]}.*$]
  else
    match = %r[amazonaws\.com]
  end
  response = File.read(File.join(SPEC_ROOT, 'fake_responses', "#{response_name.to_s}.xml"))
  FakeWeb.register_uri(:get, match, :body => response)
end

Spec::Runner.configure do |config|
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rturk-2.0.5 spec/spec_helper.rb
rturk-2.0.4 spec/spec_helper.rb
rturk-2.0.3 spec/spec_helper.rb
rturk-2.0.2 spec/spec_helper.rb
rturk-2.0.1 spec/spec_helper.rb
rturk-2.0.0 spec/spec_helper.rb