Sha256: 63e7d2bd4ec8c649c43e5537e48f48a855b354ddee128c1a8a6f9507c19370ba

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

require 'test_helper'
require 'aws/sqs'

describe AWS::SQS do

  before do
    @api = AWS::SQS.new "key", "secret"
  end

  it "points to the endpoint" do
    @api.uri.must_equal "https://sqs.us-east-1.amazonaws.com"
  end

  it "works with the current version" do
    @api.version.must_equal "2011-10-01"
  end

  describe "API calls" do

    it "builds and signs calls with ActionParam rules" do
      AWS::Connection.any_instance.expects(:call).with do |request|
        params = request.params
        params.wont_be_nil

        params["Action"].must_equal "ListQueues"
        params["Signature"].wont_be_nil

        true
      end

      obj = AWS::SQS.new "key", "secret"
      obj.list_queues
    end

    it "listens for the first parameter to be a queue URL and sets the path appropriately" do
      AWS::Connection.any_instance.expects(:call).with do |request|
        params = request.params
        params.wont_be_nil

        request.host.must_equal "sqs.us-west-1.amazonaws.com"
        request.path.must_equal "/1234567890/queue_name"

        params["MessageBody"].must_equal "This is a message body"

        true
      end

      obj = AWS::SQS.new "key", "secret"
      obj.send_message "http://sqs.us-west-1.amazonaws.com/1234567890/queue_name",
        "MessageBody" => "This is a message body"
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_aws-1.0.0 test/aws/sqs.rb
simple_aws-1.0.0.pre3 test/aws/sqs.rb
simple_aws-1.0.0.pre2 test/aws/sqs.rb
simple_aws-1.0.0.pre1 test/aws/sqs.rb
simple_aws-0.0.1d test/aws/sqs.rb
simple_aws-0.0.1c test/aws/sqs.rb
simple_aws-0.0.1b test/aws/sqs.rb