Sha256: a80191bf72b462f2f6fab424b42bef47bdf65724a2c3a710413768499f066c29

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))

describe RTurk::GetBonusPayments do
  before(:all) do
    aws = YAML.load(File.open(File.join(SPEC_ROOT, 'mturk.yml')))
    RTurk.setup(aws['AWSAccessKeyId'], aws['AWSAccessKey'], :sandbox => true)
  end

  context "a HIT with multiple payments" do
    before(:all) do
      FakeWeb.clean_registry
      faker('get_bonus_payments', :operation => 'GetBonusPayments')

      @response = RTurk::GetBonusPayments(:hit_id => 'fdsa')
    end

    it "should return 3 payments" do
      @response.payments.should have(3).things
    end

    it "should parse each payment correctly" do
      payment = @response.payments.first
      payment.bonus_amount.should == 0.04
      payment.currency_code.should == 'USD'
      payment.assignment_id.should == '180E4LY5TVT3R8QIIGL8GNEZWCF0UF'
      payment.reason.should == "Congrats! You earned a $0.04 bonus!"
      payment.grant_time.should < Time.now
    end

    it "should have unique assignment IDs" do
      ids = @response.payments.collect { |p| p.assignment_id }.uniq
      ids.should have(3).things
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rturk-2.3.6 spec/operations/get_bonus_payments_spec.rb
rturk-2.3.5 spec/operations/get_bonus_payments_spec.rb
rturk-2.3.4 spec/operations/get_bonus_payments_spec.rb