Sha256: 67ac6e5b0d295d2cd818c8773775cd7f409d6af4c5b730b9b039f9e4d8bddbfd

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

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

describe RTurk::SetHITTypeNotification do
  before(:each) do
    @lambda = lambda do
      n = RTurk::Notification.new
      n.transport = 'foo'
      n.destination = 'bar'
      n.event_type = 'baz'

      begin
        RTurk::SetHITTypeNotification(:hit_type_id => 'foo',
                                      :notification => n,
                                      :active => true)
      rescue RTurk::InvalidRequest
      end
    end
  end

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

  it 'should ensure required params' do
    lambda {
      RTurk::SetHITTypeNotification(:subject => 'peruvian mcwallball')
    }.should raise_error RTurk::MissingParameters
  end

  it 'should successfully request the operation' do
    RTurk::Requester.should_receive(:request).once.with(
      hash_including('Operation' => 'SetHITTypeNotification'))

    @lambda.call
  end

  it 'should parse and return the result' do
    @lambda.call.should be_a_kind_of RTurk::Response
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rturk-2.0.5 spec/operations/set_hit_type_notification_spec.rb