Sha256: aaeaaeff3ae409a222aa7688d8882dc143f3895b4abe0dd5153d93a46e944f0f

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 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
      WebMock.reset!
      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

18 entries across 18 versions & 1 rubygems

Version Path
rturk-2.12.1 spec/operations/get_bonus_payments_spec.rb
rturk-2.12.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.11.3 spec/operations/get_bonus_payments_spec.rb
rturk-2.11.2 spec/operations/get_bonus_payments_spec.rb
rturk-2.11.1 spec/operations/get_bonus_payments_spec.rb
rturk-2.11.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.10.3 spec/operations/get_bonus_payments_spec.rb
rturk-2.10.2 spec/operations/get_bonus_payments_spec.rb
rturk-2.10.1 spec/operations/get_bonus_payments_spec.rb
rturk-2.10.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.9.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.8.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.7.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.6.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.5.2 spec/operations/get_bonus_payments_spec.rb
rturk-2.5.0 spec/operations/get_bonus_payments_spec.rb
rturk-2.4.1 spec/operations/get_bonus_payments_spec.rb
rturk-2.4.0 spec/operations/get_bonus_payments_spec.rb